in reply to regex replace using position loop

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