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

Re^2: What does 'global' (/g) do in a regexp in this particular case?

by LanX (Chancellor)
on Apr 09, 2013 at 13:44 UTC ( #1027741=note: print w/replies, xml ) Need Help??


in reply to Re: What does 'global' (/g) do in a regexp in this particular case?
in thread What does 'global' (/g) do in a regexp in this particular case?

> As a workaround

ehm, ok! But what for???

Can't see any benefit of using /g here.

Cheers Rolf

( addicted to the Perl Programming Language)

Update

OK at least in a loop pos works on literals...

DB<139> print scalar "a a" =~ /a/g for 1..10 1111111 # third iteration is undef than restart from beginning DB<140> print scalar "a a" =~ /a/ for 1..10 1111111111 # infinite restart
  • Comment on Re^2: What does 'global' (/g) do in a regexp in this particular case?
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1027741]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (15)
As of 2016-12-08 15:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (143 votes). Check out past polls.