Hello FeistyLemur, and welcome to the Monastery!
See the section “Global matching” in perlretut#Using-regular-expressions-in-Perl, and in particular note the following (emphasis added.):
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....
A failed match or changing the target string resets the position.... The current position in the string is associated with the string, not the regexp.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re^3: A regex question.
by Athanasius
in thread A regex question.
by FeistyLemur
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |