Emacs Regex Quirk: Matching Beginning/End of Line/String/Buffer
Regex to Match Beginning of Buffer, String, or Line
Special Regex Char | Matches |
---|---|
^ | beginning of {line, string, buffer} |
\` | beginning of {string, buffer} |
(setq xstr " a b c") (replace-regexp-in-string "^ " "x" xstr) "xa xb xc" (replace-regexp-in-string "\\` " "x" xstr) "xa b c"
Regex to Match End
Special Regex Char | Matches |
---|---|
$ | end of {line, string, buffer} |
\' | end of {string, buffer} |