-1

I'm trying to user the following regular expression to extract measurement values from sizes stated in text such as:

23 x 54mm
23 cm by 56cm
25 cm
4mm
5 centimeters
etc.

and have gotten this far with the expression but am returning pattern error:


"([\- ](mm|cm|millimeter(s)?|centimeter(s)?)(?![a-z/]))" 
/
gm
All the errors detected are listed below, from left to right, as they appear in the pattern.
/ An unescaped delimiter must be escaped with a backslash (\)

Any suggestions on corrections?

DelphiData
  • 51
  • 1
  • 9

1 Answers1

0

https://javascript.info/regexp-escaping There you can read about escaping

([\- ](mm|cm|millimeter(s)?|centimeter(s)?)(?![a-z\/])) - right way to write it

Dima Vak
  • 599
  • 5
  • 20