Thanks choroba for setting me straight. If there's one thing that I keep forgetting to learn it's not to post regex questions or answers in haste. ;)
You are correct. This:
local $_ = 'foo'; m/\Gfoo/gc && say 'Matched foo'; m/\G.+/gc && say 'Matched dot star'; m/\G\z/gc && say 'Matched end of string';
...produces this:
Matched foo Matched end of string
And this:
local $_ = 'foo'; m/\Gfoo/gc && say 'Matched foo'; m/\G.*/gc && say 'Matched dot star'; m/\G\z/gc && say 'Matched end of string';
...produces this:
Matched foo Matched dot star
...indicating that end of string was consumed by dot star, though it's still a little odd because this also matches:
local $_ = 'foo'; m/\Gfoo/gc && say 'Matched foo'; m/\G.*\z/gc && say 'Matched dot star and end of string';
...produces this:
Matched foo Matched dot star and end of string
So while it may be eluded to in the documentation it's not entirely unsurprising. :)
Dave
In reply to Re^2: Seeking clarification on possible bug in regex using \G and /gc
by davido
in thread Seeking clarification on possible bug in regex using \G and /gc
by davido
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |