When text or letters are input the regex generates an error msg,Disallowing is a form of validation. And your regexp doesn't disallow what you claim it disallows. If there's a digit anywhere in the string, it doesn't generate an error message.
foreach ( '416-967-1111', 'I had 2 glasses of orange juice with my breakfast', 'I had two glasses of orange juice with my breakfast', ) { unless (/\s*\(*\)*\.*\d+\-*\s*/) { print("error message\n"); } else { print("no error message\n"); } }
outputs
no error message no error message error message
rather than the desired
no error message error message error message
In reply to Re^3: Tweak for my Perl Regex that screens for digits only
by ikegami
in thread Tweak for my Perl Regex that screens for digits only
by hackermike
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |