johngg has given a solution, but it may leave you wondering what is going on somewhat. The magic is a look behind assertion (the (?<=...) bit). It matches the given match condition (which must be a fixed length). It makes sure that the stuff matches, but the matched stuff is not part of the string that will be replaced. See perlretut and perlre for regex documentation.
In reply to Re: REGEX question
by GrandFather
in thread REGEX question
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |