Hi Glenn,
Use a negative lookahead assertion like so:
* (?i)\b(?!well|very|so|really|okay|now?|many|long|far|et
?cetera)([\p{L}]+),\s\1\b*
*\b(?!terms|to|be|excluded)* means: a word boundary not followed by any of
the terms in the alternation.
In practice, the regex will skip over any of those terms.
For more info, see BBEdit's Help menu > BBEdit Help > Quick Reference >
Grep Reference.
HTH,
Jean Jourdain
On Tuesday, November 11, 2025 at 2:52:54 AM UTC+1 Bruce Van Allen wrote:
> I wonder how many different doubled words there are in your docs.
>
> If you did a multi-file search - but not replace - with your pattern,
> BBEdit would give you a list of the instances. If scanning them shows that
> there are actually not many variations, then you might consider handling
> them with search/replace one at a time. "the, the" => "the; "but, but" =>
> "but; etc.
>
> That may take less time than composing and testing a more fully-automated
> approach. GP's suggestion shows the power of BBEdit, but if you're only
> cleaning those files this one time, maybe more than you need.
>
> I say this as a coder who will spend a couple hours working out a script
> to handle some task, and when it's ready after testing it will take 10
> seconds to actually run, and I could have done the work by hand in 20 mins
> :-).
>
> With any approach, best to work on copies of the originals until you're
> sure you have it.
>
> Also, your pattern is fairly restrictive - always exactly a comma and then
> a single space between the two words. Are your docs that consistent?
>
> HTH,
>
> — Bruce
>
> _bruce__van_allen__santa_cruz_ca_
>
>
> > On Nov 10, 2025, at 9:57 AM, GWied <[email protected]> wrote:
> >
> > This search string finds doubled words separated by a comma and a space,
> which satisfies most of the instances of doubled words:
> > (\b[A-Za-z]+\b),\s\1
> > replace with
> > \1
> >
>
>
--
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
"[email protected]" 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 [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/bbedit/3713cebd-2b59-4ef1-8a4c-eea6fe5a4ad0n%40googlegroups.com.