Page 1 of 1

Power Find(regex) quote meta characters

Posted: 2019-11-15 11:13:45
by mpawp
Hi,

The new Power Find with browser and and meta character items for Power Find Pro is awesome. In its documentation I could not find a command for quoting regex meta characters such as \Q … \E or quotemeta. Is there one? I am searching for such a command because the patterns are simple enough, which makes it unnecessary to delve further into Nisus Writer Macro than the search and replace commands available.

Regards,
Martin

Re: Power Find(regex) quote meta characters

Posted: 2019-11-18 11:14:04
by martin
Hi Martin: yes you can use \Q...\E to escape meta characters in a regex find pattern. That works in both the regular Find panel and Nisus Writer Pro macros.

Here's a quick example Nisus Writer macro:

Code: Select all

$sub = @string<\d+ \w+>
Find All @String<T\w+ \Q$sub\E \w+>, 'E'
That will match the text:
Test \d+ \w+ end
But will not match:
Test 123 word end

Re: Power Find(regex) quote meta characters

Posted: 2019-11-18 12:54:07
by mpawp
Hi,

Thank you Martin, that does work. I do not know why I did not get that to work. Together with FollowedBy and the other zero-width matches it solves many problems.

Thanks,
Martin