in reply to regexp $1 in a variable
You might find $1 in variable regex replacement string of interest for your particular problem.
-enlil