Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Making multiple replaces through Regex

by prasadbabu (Prior)
on Nov 27, 2008 at 06:15 UTC ( #726307=note: print w/ replies, xml ) Need Help??


in reply to Making multiple replaces through Regex

Hi rsriram,

It is working fine for me. If I am wrong somewhere, please correct me. Below is a sample code.

$s = '<csp c="3">'; $s =~ s/<csp c="(\d+)">/"<colspec colnum=\"1\" colname=\"col1\"\/>\n" +x $1/egs; print $s; output: -------- <colspec colnum="1" colname="col1"/> <colspec colnum="1" colname="col1"/> <colspec colnum="1" colname="col1"/>

Prasad


Comment on Re: Making multiple replaces through Regex
Download Code
Re^2: Making multiple replaces through Regex
by rsriram (Hermit) on Nov 27, 2008 at 06:18 UTC
    Hi Prasad, Upto this its working for me too! But my desired output is
    <colspec colnum="1" colname="col1"/> <colspec colnum="2" colname="col2"/> <colspec colnum="3" colname="col3"/>
    The value in colnum and colname needs to get incremented everytime! Thanks.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2014-12-18 00:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (41 votes), past polls