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.
In reply to Re^4: Leaking Regex Captures
by SuicideJunkie
in thread Leaking Regex Captures
by SuicideJunkie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |