in reply to regular expression ?!

I, too, find it hard to comment on code (you say you can make one substitution successfully) that is not presented.

However, one direction for further investigation might be the g regex modifier (see perlre and links therefrom).