in reply to hyphen in regular expression
Since [a-z]+ doesn't match hyphens, I'm guessing you are doing
# Matches if the string contains a sequence # of 1 or more lowercase letters $str =~ /[a-z]+/
when you want to do
# Matches if the string consists entirely of # a sequence of 1 or more lowercase letters, # optionally followed by a newline $str =~ /^[a-z]+$/
or
# Matches if the string consists entirely of # a sequence of 1 or more lowercase letters $str =~ /^[a-z]+\z/
|
|---|