in reply to Re^3: Leaking Regex Captures
in thread Leaking Regex Captures
That would involve a lot of post-processing to match up the numbers with the categories and filter the categories to just the valid ones ('crew', 'wounded' and 'crit'). And it can't be inserted into a larger regex match.
(A lot of work, compared to just: "passing $1, $2, ... $N and some constants into the addCommand() function if and only if the regex matches")
At the moment I have around 20-25 lines, each with a single regex guarding one call to addCommand(). I thus have a strong aversion to postprocessing on the matches which would cause the code to balloon up.
As noted earlier in the thread, I do have a workaround which is suboptimal but adequate. Optimal would be if no post-processing was required, due to the captures not getting stomped on.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Leaking Regex Captures
by Marshall (Canon) on Aug 06, 2009 at 22:29 UTC |