Re: Probably a dumb s/// question.

From: Paul Lalli (mritty_at_gmail.com)
Date: 03/16/05


Date: Wed, 16 Mar 2005 16:27:13 GMT


"Mark Healey" <die@spammer.die> wrote in message
news:pan.2005.03.16.16.17.19.236667@spammer.die...
> I'm trying to craft a search that capitalizes letters depending on
their
> context, specifically after a space or the beginning of a string.
>
> For example I'd like to turn
>
> the quick brown fox jumped over the lazy dogs.
>
> to
>
> The Quick Brown Fox Jumped Over the Lazy Dogs.
>
> Is this doable on a single line?

What have you tried so far?

Have you read the posting guidelines for this group, posted twice a
week?

Because I'm feeling generous (and bored) anyway:

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

for more information on ^, |, (), $1 & $2:
perldoc perlre
perldoc perlretut
perldoc perlreref

for more information on \u:
perldoc -f ucfirst

Paul Lalli



Relevant Pages

  • Re: Probably a dumb s/// question.
    ... > I'm trying to craft a search that capitalizes letters depending on ... > context, specifically after a space or the beginning of a string. ... > the quick brown fox jumped over the lazy dogs. ...
    (comp.lang.perl.misc)
  • Re: Probably a dumb s/// question.
    ... > I'm trying to craft a search that capitalizes letters depending on their ... > context, specifically after a space or the beginning of a string. ... > the quick brown fox jumped over the lazy dogs. ...
    (comp.lang.perl.misc)
  • Probably a dumb s/// question.
    ... I'm trying to craft a search that capitalizes letters depending on their ... context, specifically after a space or the beginning of a string. ... the quick brown fox jumped over the lazy dogs. ...
    (comp.lang.perl)
  • Probably a dumb s/// question.
    ... I'm trying to craft a search that capitalizes letters depending on their ... context, specifically after a space or the beginning of a string. ... the quick brown fox jumped over the lazy dogs. ...
    (comp.lang.perl.misc)