Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: regex for text manipulation

by gube (Parson)
on Nov 07, 2007 at 07:27 UTC ( #649422=note: print w/ replies, xml ) Need Help??


in reply to regex for text manipulation

#!/usr/local/bin/perl my $str = "today is wednesday.tomorrow IS THURSDAY"; $str =~ s/^(\w)(.*?)([.])(\w)(.*)/uc($1).lc($2).lc($3).uc($4).lc($5)/g +ei; print $str;
o/p: Today is wednesday.Tomorrow is thursday


Comment on Re: regex for text manipulation
Download Code
Replies are listed 'Best First'.
Re^2: regex for text manipulation
by sen (Hermit) on Nov 07, 2007 at 07:50 UTC

    hi,

    The third match is the dot, then why the need of lc($3), i think $3 is enough.

    $str =~ s/^(\w)(.*?)([.])(\w)(.*)/uc($1).lc($2).($3).uc($4).lc($5)/gei;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://649422]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2015-07-29 06:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls