The regular expression pattern is matched in the input string from left to right. Comparisons are case-sensitive . The ^ and $ language elements match the beginning and end of the input string. The end of the input string can be a trailing newline \n character.