} My tests pass if I call GlobalReplace in a loop, like this:
This is the solution I would propose, too. It's slower than the
optimal solution, but simple and easy to understand. Even if you
could find a regex that worked, it would probably be really
complicated.
What do you want to do with text like:
'that+the is the best'
? Do you still want to remove 'the' in this context? If so, a regex
like this might do what you want (warning, untested):
pcrecpp::RE regex("(\\b|\\s+)The(\\b|\\s+)",options);
craig