in reply to regex match
my $string =~ /[^\d\- ]/;
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 }
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (Ovid) Re: regex match
by dude01 (Novice) on May 10, 2001 at 00:34 UTC |