Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: how to do replace more then one matches?

by AnomalousMonk (Canon)
on Jun 03, 2013 at 15:06 UTC ( #1036787=note: print w/replies, xml ) Need Help??


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

Maybe something like (note the  s///g regex modifier):

>perl -wMstrict -le "my $s = 'xyz table 1 table tablet table2 fig 3 fig figer fig4 zyx'; print qq{'$s'}; ;; $s =~ s{ (?= (?: table | fig) \s* \d+) }{<aid=}xmsg; # <-- note /g m +odifier print qq{'$s'}; " 'xyz table 1 table tablet table2 fig 3 fig figer fig4 zyx' 'xyz <aid=table 1 table tablet <aid=table2 <aid=fig 3 fig figer <aid=f +ig4 zyx'

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1036787]
help
Chatterbox?
[Lady_Aleena]: james28909, I use get_data in a subroutine called movies.
[Lady_Aleena]: james28909, I put it at the top of my scratchpad, if you want to look at it.
[Lady_Aleena]: I remember being pretty proud of that little sub when I wrote it.
[james28909]: oh xD

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2017-05-24 04:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?