Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: regex replacement help

by furry_marmot (Pilgrim)
on Mar 29, 2011 at 21:47 UTC ( #896279=note: print w/ replies, xml ) Need Help??


in reply to regex replacement help

Instead of changing the tildes, use them as anchors to change the characters around them.

s/(\w)~(\w)/$1\n$2/g
--marmot

UPDATE: Changed second $1 to $2. Stupid fingers...

UPDATE2: Just realized it was wrong, as well. What was I thinking??? This should do it.

s/~/\n/g; chomp;


Comment on Re: regex replacement help
Select or Download Code
Re^2: regex replacement help
by choroba (Abbot) on Mar 31, 2011 at 11:06 UTC
    $2

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2014-11-27 13:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (184 votes), past polls