in reply to creating regular expressions dynamically from the command line
You may want to take a look at grinder's Regexp::Assemble (see Why machine-generated solutions will never cease to amaze me for some background).
HTH,