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


in reply to Regular Expression Builder

Given a string like "Rich36!", it would produce \w{4}\d{2}\! or \w+\d+\!.

And why wouldn't it produce one of these

/\w{6}!/ /\w+!/ /[A-Z][a-z]{3}\d\d!/ /Rich36!/ /......./ /\S+/ /.*/

I mean, the tightest or least general thing it could produce when given a $string is just /\Q$string\E/ and the most general thing would be /.*/s, and between those is a rather large space of candidates.