Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: how to do replace more then one matches?

by 2teez (Vicar)
on Jun 03, 2013 at 09:39 UTC ( [id://1036703]=note: print w/replies, xml ) Need Help??


in reply to how to do replace more then one matches?

You mean something like this?:

use warnings; use strict; my $li = "abbjghfg table 1 vinoth figer table2"; my $new_str; while ( $li =~ m/(.+?)(table.?\d)/gc ) { $new_str .= $1 . '<aid=' . $2; } print $new_str, $/; #abbjghfg <aid=table 1 vinoth figer <aid=table2
Update: Why to avoid using $&, $`, or $' in your program

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-26 00:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found