Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 (Canon) 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 perusing the Monastery: (4)
As of 2015-07-06 04:13 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 (70 votes), past polls