I don't understand why, but the @- only has one element
That's the way capturing works if you have the "+" outside of the capturing parens (i.e. only the last match is captured). Try putting the parens around the entire subpattern:
((?:.<(?:symConstant|variable)>[^<]*</(?:symConstant|variable)>)+)
This way you also don't need the foreach loop assembling $text — just set $text = $1
In reply to Re: regex replace using position loop
by Eliya
in thread regex replace using position loop
by nglenn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |