Search/replace list issues
Posted: Tue Jan 03, 2012 3:48 am
There are subtle but critical differences in the way that replace filters work!
Here is the required action:
Compare using the following two methods:
With the latter, priority is given to the "\n" part of the replacement pattern, and this is incorrectly interpreted as a "new line".
The contextual help for both methods does not give any clue why the results should be different.
In fact the help for both methods ultimately leads one back to the pattern matching reference.
Method 2 is summarized as "This filter is used to easily define a set of search/replace pairs that have identical search options."
I discovered the issue after combining several consecutive replace filters (with identical search options) into a search/replace list.
It was somewhat annoying to have to add workarounds to address this issue, especially after having tested and debugged and each filter separately.
David
Here is the required action:
Code: Select all
Perl pattern [(\Q\i0 \E)] with [\\nosupersub$1\\super ]
[X] Match case
[ ] Whole words only
[ ] Case sensitive replace
[ ] Prompt on replace
[ ] Skip prompt if identical
[ ] First only
[ ] Extract matches
Maximum text buffer size 4096
[ ] Maximum match (greedy)
[ ] Allow comments
[ ] '.' matches newline
[X] UTF-8 Support
- Method 1: Find pattern (perl style)
Method 2: Search/replace list
- Method 1 works as required.
Method 2 does not!
With the latter, priority is given to the "\n" part of the replacement pattern, and this is incorrectly interpreted as a "new line".
The contextual help for both methods does not give any clue why the results should be different.
In fact the help for both methods ultimately leads one back to the pattern matching reference.
Method 2 is summarized as "This filter is used to easily define a set of search/replace pairs that have identical search options."
I discovered the issue after combining several consecutive replace filters (with identical search options) into a search/replace list.
It was somewhat annoying to have to add workarounds to address this issue, especially after having tested and debugged and each filter separately.
David