Hello, @brent-parker, @terry-r, @neil-schipper and All,
So, @brent-parker, given this INPUT text :
I run this regex test " but I suppose it will be OK ". However, I must verify this assertion. We went out for a walk in the country-side. " On the way back, we can take some cakes ". We often come to this store. They are going to the movies tonight. " They hope it will be interesting ". They had, indeed, been disappointed the previous time!Use this regex S/R :
SEARCH (?x-is) " .+? " (*SKIP) (*F) | \b (?: ( I ) | ( We ) | ( They ) ) \b
REPLACE (?1Guy)(?2Bob and me)(?3The group)
And you’ll get your expected OUTPUT text :
Guy run this regex test " but I suppose it will be OK ". However, Guy must verify this assertion. Bob and me went out for a walk in the country-side. " On the way back, we can take some cakes ". Bob and me often come to this store. The group are going to the movies tonight. " They hope it will be interesting ". The group had, indeed, been disappointed the previous time!Notes :
The search regex uses a non-common modifier (?x) which enables the free-space mode for a better identification of the regex parts
The search regex uses a special structure, called Backtracking Control Verbs. This specific form (*SKIP) (*F) can be understood as :
What I don’t want (*SKIP) (*F) | What I want
We do not want everything between double-quotes and we do want to replace some words with an alternative text, accordingly !
So, any word I is changed by Guy, any word We is changed into Bob and me and any word They is replaced by The group, when they all are not found within double-quotes zones ;-))
Best Regards,
guy038