http://www.perlmonks.org?node_id=194196


in reply to Regular Expression Builder

Just a thought: replace all letters by "A" and all digits by "9". Then apply the Regex::PreSuf thing — or just quotemeta(). And in that result, replace "A" with '\w' and "9" with '\d'.

Intermediate steps, as an example: @foo23  ->  @AAA99  ->  \@AAA99  ->  \@\w\w\w\d\d