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 betweencand\n? - What is the regex that matches
\n?
(re-search-forward "\n")works fine for me. – Dan Feb 25 '15 at 00:37abc\r\ninstead ofabc\n. – Jordon Biondo Feb 25 '15 at 15:53\nton. my buffer is in Fundamental mode. This happens to any text, so any text with new line or letternis a working example – Tim Feb 27 '15 at 02:17\r\ntorn– Tim Feb 27 '15 at 02:18\nmatches 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\nmatches the lettern. – Omar Jul 11 '19 at 19:17(looking-at "\r?\n")matches both line styles. – Devon Jan 04 '23 at 19:41