in reply to Re^2: Arbitrary number of captures in a regular expression
in thread Arbitrary number of captures in a regular expression
Using lexical (my) variables from outside the regex in (?{ ... }) is dangerous. Your code will break if it's moved to a function. Use package (our/use vars) variables instead.
Also, it's unsafe to modify @match at the point where you did modify it. If any backtracking through that the (?{ ... }) that changes @match occurs, you won't get the correct result. Now, the only time your code backtracks is when the match is unsuccessful. Even if you realized that and found it acceptable, you're playing with fire for the smallest change to the regexp can change that.
See earlier post Re: Arbitrary number of captures in a regular expression for the safe approach.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Arbitrary number of captures in a regular expression
by mwah (Hermit) on Sep 25, 2007 at 20:15 UTC |