Hi,
An example of the text and a description of what you’re trying to accomplish would help.
From your find pattern, I’m guessing you’re trying to find cases where a string is followed by the same string, to be replaced by just one instance of the string.
'\b(\w+)+\1\b’ (your original - without the quotes)
Your find pattern’s second plus sign ‘+’ isn’t doing anything, because the first one, which quantifies the ‘\w’, is grabbing every consecutive word/alphanumeric character including any repetitions.
Removing that second ‘+', the find pattern '\b(\w+)\1\b’ (without the quotes) will find a string of word characters followed immediately by the same string, as in ‘My sentence is abcabc for defdef.’ Using your replacement pattern of ‘\1’, this will become ‘My sentence is abc for def.’
Guessing that you’re are actually looking for duplicated WORDS, if the find pattern has a spacebar space ‘ ‘ then it will find any word followed by a space and then the same exact word, and the replacement will eliminate the duplication.
With find pattern '\b(\w+) \1\b’, your replacement pattern makes 'My sentence is abc abc for def def.’ into 'My sentence is abc for def.’
If you want to find a string of word characters that matches an earlier instance of the same string but separated by more than just a space, your pattern may be more complicated.
HTH and please clarify if my guesses are wrong.
— Bruce
_bruce__van_allen__santa_cruz_ca_
> --
> This is the BBEdit Talk public discussion group. If you have a feature request or believe that the application isn't working correctly, please email "
sup...@barebones.com" rather than posting here. Follow @bbedit on Mastodon: <
https://mastodon.social/@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
bbedit+un...@googlegroups.com.
> To view this discussion visit
https://groups.google.com/d/msgid/bbedit/c9e18d6f-f5c4-467e-9c01-fa4ffbaa5485n%40googlegroups.com.