`.` need to be escaped, otherwise it will match any character. Also improve code style for handling string s.