in reply to Parenthesis Match

The problem with your regex is that if the open paren is preceded by a space, the your regex will match ' (' and attempt to upper the left paren. Having matched those two characters successfully, the next match attempt starts with the first character following the paren, and so will skip the <paren><lowercase> pairing.

One way to fix this is to make sure that the ' (' doesn't match ' (', by only matching where the second character is a lowercase char.

s/(-| |^|\()([a-z])/$1\u$2/g;

Perhaps a better way would be to use \b to detect the start of words.

s/(\b[a-z])/\u$1/g;

This is slightly different in that anylowercase character preceded by a non-word char will be uppered. This may or may not fit your definition of a word.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail