in reply to Using Regexp Patterns as Variables

You are having interpolation problems. This was discussed last week in regex search failsbackreference replaced as literal or just fails.

Update: Linked to the wrong article. I need a vacation.