Hello, used the following regular expression to check if a space is missing before “**mm**” in the following sentence, but it doesn’t work, please help me to see how to solve this problem.

Thank you.

Hello, used the following regular expression to check if a space is missing before “**mm**” in the following sentence, but it doesn’t work, please help me to see how to solve this problem.

Thank you.

To find segments containing space before mm, try the following search:

Target: `"[0-9]+[:space:]mm>"`

Search mode: regular expressions

PowerSearch: on

Tried it, but it still didn’t work.

To find segments that **do not** have a space before mm, try the following search:

Target: `"[0-9]+mm>"`

Search mode: regular expressions

PowerSearch: on

Yes, it works. Thank you.

Another question, how to check if there are spaces between all numbers and units by a regular expression?

For Example:

4.2 dm

57 m

34.54 cm

35.9 mm

87 dB

…

The following Regular Expression finds entries **that have ONE space** between the number and the unit in your list):

`[0-9][:space:](dm|m|cm|mm|dB)>`

The following Regular Expression finds entries **that DO NOT have spaces** between the number and the unit in your list):

`[0-9](dm|m|cm|mm|dB)>`

Seems not work, the error report is shown below

In this case you need to unselect Powersearch (it is not needed for this particular search).

If there are parentheses in the expression and you need use Powersearch, then you need to enclose expressions in straight double quotes so that Powersearch considers the whole expression as a unit.

1 Like