dude01 has asked for the wisdom of the Perl Monks concerning the following question:
my $string =~ /[^\d\- ]/; [download]
Of course, how you actually turn that into a useful regular expression will depend upon the structure of the data to be tested.
For example, if you want to ensure that $string has no characters that you wish to exclude (and is not empty):
if ( $string =~ /^[^\d\- ]+$/ ) { # do something here } [download]
Cheers, Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.