in reply to can't get $& to remove value in a substitution

I don't really see a problem with the code. In fact, copying your code to my machine and running it seems to give the result you are looking for.

Output:

match: before ..... <textarea class="FolderTxtArea" name="blah"><%=foo +::doSomething%></textarea> varmatch: <%=foo::doSomething%> match: after .... <textarea class="FolderTxtArea" name="blah"></texta +rea> match: after testinsert .... <testinsert<%=foo::doSomething%> class=" +FolderTxtArea" name="blah"></testinsert<%=foo::doSomething%>>

I did notice that the output you're giving in your question doesn't match the order in which the print statements appear in the code. Perhaps you're looking at old output?

~CubicSpline
"No one tosses a Dwarf!"