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

Re^2: Seeking clarification on possible bug in regex using \G and /gc

by Rhandom (Curate)
on Mar 14, 2018 at 23:22 UTC ( [id://1210923]=note: print w/replies, xml ) Need Help??


in reply to Re: Seeking clarification on possible bug in regex using \G and /gc
in thread Seeking clarification on possible bug in regex using \G and /gc

The closest mention I could see to this problem and perhaps a clue is: The additional state of being matched with zero-length is associated with the matched string, and is reset by each assignment to "pos()". So perhaps the issue is that the previous match succeeded - but did not advance pos, so when the /\G \z/ hits, pos doesn't advance and for some reason perl doesn't treat it as a successful match. I'm still with davido. I think this is a bit of a bug - it introduces failure at a distance in custom parsing engines. Luckily for cases such as these pos == length happens to be true.
my @a=qw(random brilliant braindead); print $a[rand(@a)];
  • Comment on Re^2: Seeking clarification on possible bug in regex using \G and /gc

Replies are listed 'Best First'.
Re^3: Seeking clarification on possible bug in regex using \G and /gc
by Anonymous Monk on Mar 15, 2018 at 18:54 UTC

    The opposite would be worse. If it didn't work like this, subtle differences would be introduced when you refactor some code, merging regexen or splitting them apart.

Log In?
Username:
Password:

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

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

    No recent polls found