Page 1 of 1

Replace Exact misparses $ in Replace with

Posted: Mon Feb 13, 2012 11:45 pm
by dfhtextpipe
The following subfilter reports an error:

Code: Select all

Replace [$$$Matthew 0:0\r\n] with [$$$[ Testament 2 Heading ]\r\n\r\n$$$Matthew 0:0\r\n]
   [X] Match case
   [ ] Whole words only
   [ ] Case sensitive replace
   [ ] Prompt on replace
   [ ] Skip prompt if identical
   [ ] First only
   [ ] Extract matches
 
The logged error message is

Code: Select all

2012-02-13 13:39:05,Error,$M is not a valid subexpression identifier for this pattern.
The maximum allowed subexpression identifier is $0 (or escape the $ sign using '$$')
Surely $n variables are only applicable for Perl patterns, not for Replace Exact ?

David

Re: Replace Exact misparses $ in Replace with

Posted: Mon Feb 13, 2012 11:55 pm
by dfhtextpipe
A workaround is to double up the $ characters in the replace with:

Code: Select all

Replace [$$$Matthew 0:0\r\n] with [$$$$$$[ Testament 2 Heading ]\r\n\r\n$$$$$$Matthew 0:0\r\n]
   [X] Match case
   [ ] Whole words only
   [ ] Case sensitive replace
   [ ] Prompt on replace
   [ ] Skip prompt if identical
   [ ] First only
   [ ] Extract matches
 
IMHO, Such doubling of special matching characters should only be required for Perl pattern replacements!

Re: Replace Exact misparses $ in Replace with

Posted: Thu Feb 16, 2012 6:17 am
by DataMystic Support
It was designed to allow replacing an exact match with extra text, using the same case as the original text.

If you right-click the field, you can escape these very easily.

Re: Replace Exact misparses $ in Replace with

Posted: Mon Feb 20, 2012 3:57 am
by dfhtextpipe
Thanks.