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 also be set using the clustering (non-capturing) parentheses syntax defined earlier, by inserting the option letters between the “?” and “:”. But if it is just to turn off capture then why does the match fail without the colon? On Sunday, September 19, 2021 at 7:06:05 PM UTC-7 Neil Faiman wrote: > 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 > certainly overkill for this problem. > > Regards, > > Neil Faiman > > > On Sep 19, 2021, at 9:31 PM, Tim A <[email protected]> wrote: > > > > 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 adequate to just use ... > > Search: (?s)AAA\n.+?BBB > > Replace: AAA\nBBB > > -- This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "[email protected]" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/b293846a-cd80-4168-8f2b-bd7eeb284faen%40googlegroups.com.
