Using Regex with PowerSearch

Hello,

I am trying to create a checklist item that will identify numbers separated by EN-dash or regular dash with optional spaces around the dash, and make sure that the target has these numbers separated by EN-dash only.
PowerSearch = ON
Source: ([0-9]{1,3})=1[:space:][–-][:space:]([0-9])=2
Source mode: Regex
Target: -@1@2
Target mode: Simple (also tried Regex)
However, with PowerSearch=ON, I get the following error: Error in source: incomplete expression, and the cursor moves till after the first closing parenthesis. I tried putting a simple (s) in the Source but the same error appears.

What am I doing wrong?

Thanks!
Denis

The following search should find those segments:

Source: "<([0-9]{1,3})=1[:space:]?[\-\x2013][:space:]?([0-9]{1,3}>)=2"
Target: -"<@1\x2013@2>"
PowerSearch: On.
Search Mode: Regular Expressions

The regular dash should be escaped when search as a character in regex syntax. The ? character after [:space:] means that there can be one or zero spaces. ``\x2013` is the hexadecimal value of the en-dash.

Hope this helps.

Thanks a lot! It works!

However, I don’t understand why it does not work without double quotes in the Source expression (an error about ) appears). I have not seen an explanation about double quotes in the source within your online documentation. Could you please explain why they are needed?

Thanks!
Denis

The regular dash is not escaped in your source regex. With powersearch on, - is used as a negative operator if not escaped as \-.

In this case, this results in the error message.

Thanks, it makes sense now!