There are also variations of one of this faq's answers
which are a little shorter and also adjustable:
perl -le '$_="ZENO WAS HERE";s/([^\s.,-]+)/\u\L$1/g;print'
perl -le '$_="DANGER was hERe too";s/(\S+)/\u\L$1/g;print'
| [reply] [d/l] |
I suggest
s/([^\s\w]*)(\S+)/$1\u\L$2/g;
instead. It treats things like q{"not a question" folks} (which becomes q{"Not A Question" Folks}).
japhy --
Perl and Regex Hacker
| [reply] [d/l] |
The trick there is making sure the first character is a word character. Here's a shorter version of the same thing:
s/(\w\S*)/\u\L$1/g;
| [reply] [d/l] |
Nice, but both this and chipmunk's can't handle "just,another,list,of,words" (ie. punctuation without spaces)... why not just:
s/(\w+)/\u\L$1/g;
Update: eating self-served humble pie, never mind, this can't deal with "i promise i won't shouldn't can't reply without thinking..." :) | [reply] [d/l] [select] |