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

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

by hdb (Prior)
on Apr 09, 2013 at 13:37 UTC ( #1027737=note: print w/replies, xml ) Need Help??


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

From perlretut:

"The modifier //g stands for global matching and allows the matching operator to match within a string as many times as possible. In scalar context, successive invocations against a string will have //g jump from match to match, keeping track of position in the string as it goes along. "

If both your matching operators have /g, they become part of one operation, which can consume "Property" only once.

  • Comment on Re: What does 'global' (/g) do in a regexp in this particular case?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1027737]
help
Chatterbox?
[hippo]: Those are auto-posted. We just update them.
[LanX]: "you haven't been a monk" ???
[LanX]: oh "yet" .. got it
[Eily]: LanX: sadly I wasn't born a monk
[LanX]: #SoSad #Shame
LanX silently plays Springsteen in the background "♪..♫ ... I'm on fire ..."

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (14)
As of 2017-03-24 14:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (304 votes). Check out past polls.