I can't endorse this approach as a Good Idea™, but you may want to take a look at Regexp::Assemble if you insist on a regex-based solution.
HTH,
planetscapeIn reply to Re: Automatically generate regular expression from source data
by planetscape
in thread Automatically generate regular expression from source data
by onelesd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |