In Emacs regex, \n
doesn't match a new line character \n
.
- Am I correct that
$
matches the position between a new line character and the character right before the new line character. e.g. for a stringabc\n
,$
matches the position betweenc
and\n
? - What is the regex that matches
\n
?
(re-search-forward "\n")
works fine for me. – Dan Feb 25 '15 at 00:37abc\r\n
instead ofabc\n
. – Jordon Biondo Feb 25 '15 at 15:53\n
ton
. my buffer is in Fundamental mode. This happens to any text, so any text with new line or lettern
is a working example – Tim Feb 27 '15 at 02:17\r\n
torn
– Tim Feb 27 '15 at 02:18\n
matches a newline, you'd need to escape the backslash in the string, i.e., to use(re-search-forward "\\n")
. If you do that you'll see that\n
matches the lettern
. – Omar Jul 11 '19 at 19:17(looking-at "\r?\n")
matches both line styles. – Devon Jan 04 '23 at 19:41