in reply to RegExp Capitalization of Entry
This keeps "and", "an", "a", "the", "or", "of", and "on" in lowercase. Add to that as needed.($str = lc $str) =~ s{ (?: ^ | \b (?! (?:and|an?|the|o[rfn]) \b ) ) (\w) }{\u$1}gx;
I still hate Perl's regex engine. It cannot possibly match BOL (beginning of line) after the first character, so why the hell does it try?
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;
|
---|