Like Chuck mentioned in his comment, I can't duplicate the behavior you're asking about.
One possible reason for errors like this: One or more spaces between DATE and MODIFIED.
Solution: Check with an regular expression:
[
"DATE MODIFIED",
"DATE MODIFIED", #2 spaces
].each{|aString|
print "Check #{aString}: "
case aString
when "DATE MODIFIED"
puts "Exact hit with one space"
#without \A/\Z the string could be part of a longer String
when /\ADATE\s+MODIFIED\Z/
puts "hit with one or more spaces"
end
}
Another often made error: The String is read from stdin and includes a newline. Solution: Use a regex or check with String#chomp (or String#split if you want to ignore leading and trailing spaces)