in reply to Perl regex \G /g and /gc

//g in list context finds all (the remaining) matches. Use it in scalar (or void) context to find the next match.

Replies are listed 'Best First'.
Re^2: Perl regex \G /g and /gc
by tj_thompson (Monk) on Sep 17, 2014 at 16:14 UTC
    Exactly the information I was looking for. For some reason context didn't cross my mind. Thanks as always Ikegami :)
Re^2: Perl regex \G /g and /gc
by uhClem (Scribe) on Aug 06, 2015 at 16:31 UTC
    Context! I've just spent hours trying to figure out why a /\G/g wasn't doing what I wanted; finally stumbled across this. Context! I may have overlooked it but I think the docs fail to spell that behavior out clearly. Or anyway, not blatantly enough for me to catch on.