[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-AnyPerl] a regex guestion



On Fri, Sep 10, 1999 at 10:04:25AM -0600, slf9y@cc.usu.edu wrote:
> I want to convert anything at the beginning of a work to caps i.e.
> an expression like this -> An Expression Like This
> I know I can find it by using
>  $string =~ s/\b[a-z]/And I don't know what to put here.../g;
> I can find the pattern, it's the convertying that's getting me. Any help
> appreciated...
> 

Something like this:

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

but be aware that this will turn "it's not right" into "It'S Not Right".
A regex to match words properly is a bit tricky.


Ronald

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org