in reply to Dynamic Regex?

Your never make it to the regex test because $min (at least in your code) is a true value and your sanity checks aren't cumulative but mutually exclusive thanks to the if ( $min ) structure.

Perhaps you meant to roll the two ifs into one so that you can fall through to the other tests?

if ( $min && $len < $min ) # <> 0 { $err .= wes( "$lbl cannot be blank." ); }

Also, if you're going to pass a regex like that, it either needs to be done as qr/\W/, sans the slashes, or be evaled so that the slashes aren't treated literally.

You may want to rethink your regex, logic, and error message as they seem to be at odds with another: it should be \w instead of \W (or an if instead of unless), and there prolly ought to be some anchors so that bogus input with a single valid match doesn't pass.

Finally, on reinventing the wheel ... have you looked at HTML::FormValidator? :)

    --k.