The manual describes the regexp special characters
$. Like in most regular expression dialects I know, they seem to match the start or end of a string. However, I've also discovered that there are
' characters available. Based on the explanation found here, they seem to also match the start or end of strings. Could someone please explain the difference between these special characters, with an example and recommendation on when to use them?
When I look at the value of
auto-mode-alist, they seem to be used interchangeably to match the end of strings:
(... ("\\.scss\\'" . scss-mode) ("\\.ya?ml$" . yaml-mode) ...)
$like that, they are banking on filenames not containing newlines. This is typically going to be a (very) safe assumption, but it's not guaranteed. Using
\\'is therefore best practice.