It would be easier to debug if you posted the real stuff.
In reply to Re: Using array variable in regex substitution by johnny_carlos in thread Using array variable in regex substitution by tunafish