SUMMARY When entering certain regular expressions in Search / Replace, the Replace function does not work. STEPS TO REPRODUCE 1. Enter the following into a new text file: Phrase A: Words Phrase A: Words Phrase A: Words Phrase B: Words Phrase B: Words Phrase A: Words Phrase A: Words Phrase B: Words Phrase A: Words Phrase A: Words 2. Open Search window on bottom 3. Enable Regular Expressions and Expand Results 4. Enter the following in Search: `(?<=Phrase A: ).*[\r\n]+\KPhrase A: ` 5. This PCRE Regular Expression finds and selects a specified phrase at the beginning of sentences, **only if** it is preceded by a sentence that also contains the phrase. The first sentence containing the phrase is **not** selected. So in this example, it finds `Phrase A: ` in lines 2, 3, 7, and 10. 6. Enter any text for replacement, or leave blank for deletion. Click the "Replace" button. OBSERVED RESULT It cycles through the results but has no effect. Nothing is replaced. EXPECTED RESULT Highlighted found results should be replaced by whatever is entered in "Replace" field. SOFTWARE/OS VERSIONS Windows: 10 Professional 2004 ADDITIONAL INFORMATION From what I checked so far, this behavior exists as far back as 2022 (v22.08.1) and is still present in the latest nightly builds.
This is my first time posting here so I noticed markdown doesn't work here, so make sure to leave the ` out, i.e., regular expression entered should be: (?<=Phrase A: ).*[\r\n]+\KPhrase A: Make sure to leave a space at the end of the line after A:
I can reproduce this both with the plugin and the built-in search. Those lookbehind regexps are tricky to get right :(