Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
So in other words if the string is:$string = "hello world"; then the check would be ok, but if it had:$string = "hello world!"; Then it would not because it had a ! in it. But I don't want to check just for ! or other characters, I want to make sure it ONLY has a-z, A-Z and 0 to 9 and that is it.[a-zA-Z0-9]
That is what I cannot find. I have searched everywhere, for everything I can think of, like 'alphanumeric only' 'alphanumeric' 'regex alphanumeric' but I keep coming up empty handed.my $string = "I am not a window washer."; if($string =~ ?what pattern would I search for?) { # Oops has invalid character } else { # String is perfect only alphanumeric }
|
|---|