Upper case after an O' like O'Hugo

From the FAQ:

There are irish/scottish names like O'Donnel, O'Leary etc, that all should be upper case. But you cannot use upper case in general after an ' because the following examples are wrong spelled then (That'S, Ain'T etc.). How can I only get upper case after an O'?

Create a new action in an existing action group and choose Replace with regular expression as action type.
Regular expression: O'(.{1})
Replace matches with: O'$upper($1)

This doesn't appear to work. It catches O'Hugo OK, but it also turns "Romeo's" into "RomeO'S".

Or did I do it wrong?


caps for 'irish' names but not contractions?

... or ...
Action: Replace using Regular Expression
Regular Expression: \b.'.
Replace by: \U$0


You can check
[x] case-sensitive comparison
to avoid that.