Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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;

Replies are listed 'Best First'.
Re^2: regex replacement help
by choroba (Chancellor) 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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2017-04-23 19:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.