You're missing the point. It's not that he's using grep,
but that he's anchored the match with a $ at the
end of the regexp that's important. You were matching more
than you thought you should be because you hadn't specified
that the regexp had to match the entire string.