In the substitution part $2 holds the match-group you do not seem to want.
So take one of the other groups!
Could be that you will need to add new groups with parens: ( regexes ), shouldn't be too complicated cause this regex is really well documented.
see perlretut#Extracting matches for about how grouping and numbered vars work.
Cheers Rolf
In reply to Re: Print what regex finds or invert regex for substitution
by LanX
in thread Print what regex finds or invert regex for substitution
by BrianBSL
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |