You might find $1 in variable regex replacement string of interest for your particular problem.
-enlil
In reply to Re: regexp $1 in a variable by Enlil in thread regexp $1 in a variable by almaric