in reply to safe method to execute perl code with user input?
It should be dooable to parse the regex for unsafe constructs using one of YAPE::Regex, Regexp::Parser, PPIx::Regexp
and then safely interpolate $1... using String::Interpolate::RE