in reply to Matching inconsistency in for loop
You are using m//g in a scalar context which means that each match starts off where the previous match ended. That is, each match is only going to succeed if either the previous match failed or if the requested match happens later in the string than the previous match.
This starting (and previous ending) position can be queried via pos($answer), and can even be set via pos($answer)= 0;
You should probably just drop the "g"s.
Also, you didn't always use \Q and \E which could also cause you problems (though it didn't appear to in this case).
- tye (but my friends call me "Tye")
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (tye)Re: Matching inconsistency in for loop
by Rich36 (Chaplain) on Dec 13, 2001 at 02:04 UTC | |
by tye (Sage) on Dec 13, 2001 at 02:13 UTC | |
by Rich36 (Chaplain) on Dec 13, 2001 at 02:41 UTC |