in reply to Re^2: A regex question.
in thread A regex question.
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, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: A regex question.
by FeistyLemur (Acolyte) on Aug 02, 2015 at 05:15 UTC |