Sorry couldn't think of a short snappy title to this problem.
Is there a way of using the grouping re capability in Perl without (implicity) increasing the variable count. That is I want to match and replace some stuff without ending up referring to $largenumber.
For example, given the substitution
s/(some|stuff)(more|stuff).*?(what I really want here)/$3/;
I would like to use $1 rather than $3 cause the first two groupings are really there just to anchor the pattern. I don't need them in the substitution.
A more extreme case is
$htmltag="(<[^>]+>)"; s/<td>$htmltag{99}(.*?)<\/td>/$100/;
I really am just interested in the (.*?) grouping, the other groupings are just there to make the repetition count work out right. Am I stuck with $100 or is there a way to group expressions without using parentheses?
Thanks,
M
Code tags added by GrandFather
In reply to Grouping regular expressions by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |