Re: How to replace contents between two specific words

2021-09-20 Thread Neil Faiman
(?:subpattern) by itself makes the parentheses non-capturing. But (?letters:subpattern) sets GREP options that apply just to the subpattern within the parentheses. (The alternative is (?letters) which sets GREP options that apply to everything that comes after it in the pattern.) The ?s

Re: How to replace contents between two specific words

2021-09-19 Thread Tim A
Overkill is a great way to learn. Experimenting further I got my solution to fail when AAA and/or BBB was not by itself. Now I am trying to figure out what the *?s:* colon business is in your solution (?<=^AAA\n)(?s:.*?)(?=^BBB$) pg 197 of manual for version 12.6.7 These options can

Re: How to replace contents between two specific words

2021-09-19 Thread Neil Faiman
Only the OP knows exactly what the delimiter rule is — any occurrence of AAA and BBB, or as words, or as complete lines … — so the best way to code the delimiters isn’t clear, but aside from that, I agree completely. Using pre- and post-assertions to match just the string to be removed is

Re: How to replace contents between two specific words

2021-09-19 Thread Tim A
On Saturday, September 18, 2021 at 10:01:50 AM UTC-7 Neil Faiman wrote: > Use this “Find” string: (?s)(?<=\bAAA\b).*?(?=\bBBB\b) > Neil's solution encouraged me to learn about "Pattern Modifiers", e.g. (?imsx) And I am able to parse the look around aspects of his solution... but isn't it

Re: How to replace contents between two specific words

2021-09-18 Thread Neil Faiman
Cmd-F to open the search dialog. Use this “Find” string: (?s)(?<=\bAAA\b).*?(?=\bBBB\b) Make sure “Grep” and “Case sensitive” are checked. Make the “Replace” string empty. Click “Replace All”. \bAAA\b and \bBBB\b match “AAA” and “BBB” only when they appear as complete words. If that isn’t

How to replace contents between two specific words

2021-09-18 Thread Nowaki A
I have a thousands of word file with the contents I want to delete. All the contents I want to delete are between exactly the same two specified words. How do I replace or remove the contents? For example AAA *** *** *** *** *** BBB