Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Search and Replace

by maverick (Curate)
on Jul 19, 2000 at 20:01 UTC ( [id://23217]=note: print w/replies, xml ) Need Help??


in reply to Search and Replace

if there is a single ; to be replaced you could do
$string =~ s/^(.*\(.*);(.*\).*)$/$1,$2/;
if there's an unspecified number
($a,$b,$c) = split(/[()]/,$string); $b =~ s/;/,/g; $string = $a."(".$b.")".$c;
there's probably a way to do it in single regexp, but I don't have enough caffeine in my blood to see it yet.

/\/\averick

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2024-04-19 15:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found