Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Modifying the match position after each match

by ikegami (Patriarch)
on Mar 23, 2010 at 21:44 UTC ( [id://830407]=note: print w/replies, xml ) Need Help??


in reply to Re: Modifying the match position after each match
in thread Modifying the match position after each match

The solution you added in the update doesn't work.
$string =~ s/(_)[^']/$1'/g;
should be
$string =~ s/(_)([^'])/$1'$2/g;
That can also be written as
$string =~ s/(_)(?=[^'])/$1'/g;
and
$string =~ s/_\K(?=[^'])/'/g; # 5.10+

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (8)
As of 2024-03-28 09:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found