Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Making multiple replaces through Regex

by Punitha (Priest)
on Nov 27, 2008 at 06:23 UTC ( #726310=note: print w/ replies, xml ) Need Help??


in reply to Making multiple replaces through Regex

Try like this,

my ($colno) = $_ =~ /<csp c="(\d+)">/; my $csp; for my $i (1..$colno) { $csp = $csp."<colspec colnum=\"$i\" colname=\"col$i\"\/>\n"; } $_=~s/<csp c=\"$colno\">/$csp/g; print "$_";

Punitha

Comment on Re: Making multiple replaces through Regex
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2016-04-30 17:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    :nehw tseb si esrever ni gnitirW







    Results (441 votes). Check out past polls.