SPUG: regular expressions
Randy Rue
rrue at fhcrc.org
Tue Jan 17 14:07:14 PST 2006
Bear with me for a newbie question, I'm right at the second regex
chapeter in Learning Pearl and this question caught my attention:
What does the (\w) in the pattern do to the \b word separator? I thought
it might give whitespace as the word delimiter (and so keep words like
"that's" as a single word) but the output still comes out as "That'S."
How else could I treat contractions?
Randy Rue
Jeremy Mates wrote:
> * luis medrano <lmzaldivar at gmail.com>
>
>>perl is number one
>>to
>>Perl Is Number One
>
>
> Quick, dirty, and possibly missing all sorts of edge cases:
>
> echo test ing | perl -pe 's/\b(\w)/\U$1/g'
>
> Depending on what you are doing, also consider {case => title} or {case
> => highlight} of the nifty Text::Autoformat module.
>
> http://search.cpan.org/perldoc/Text::Autoformat
>
> _____________________________________________________________
> Seattle Perl Users Group Mailing List
> POST TO: spug-list at pm.org
> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
> MEETINGS: 3rd Tuesdays
> WEB PAGE: http://seattleperl.org/
--
Randall Rue
System Administrator
IT, Server Operations
Fred Hutchinson Cancer Research Center
1100 Fairview Ave N #J4-414
Seattle, WA 98109-1024
USA
(206) 667-3662
FAX (206) 667-7733
More information about the spug-list
mailing list