if ($string =~ /^[a-z]+$/) { # we have a string of at least one character of the range a-z } #### if ($string =~ /[^a-z]/) { # if it contains even one character NOT in the range, it doesn't meet the criteria # do some error }