2017-03-06 23:09 GMT+03:00 Bram Moolenaar <[email protected]>: > > Shawn Corey wrote: > >> On Mon, 6 Mar 2017 08:01:58 -0800 (PST) >> Ben Fritz <[email protected]> wrote: >> >> > But, you can still match end-of-line in the middle of a pattern using >> > "\n". >> >> No, that matches a new-line character. The difference is that $ matches >> the end of the line, not a character. This is called an anchor. >> >> "Anchors are a different breed. They do not match any character at all. >> Instead, they match a position before, after, or between characters." >> http://www.regular-expressions.info/anchors.html > > Using '\n' does not match a character. > > Don't try to apply terminology from some other regexp engine to Vim, it > will just confuse you. In Vim terminology there is no anchor.
For reference: Vim documentation names such things “zero-width match” (`:h /zero-width`). `\n` may match a character if you use it in functions like `substitute()` (where pattern applies to one of the string arguments), but when searching a buffer this is some kind of pseudocharacter: 1. not zero-width because you can join lines using `s/\n//`, 2. also matches at the very end of the buffer even if `&endofline` is set to zero (designating that last line in the buffer should not end with a LF/CRLF/CR) 3. matches line end always, regardless of &fileformat setting (meaning that “physically” file may contain \n, \r\n or \r when being written) 4. internally there are no characters corresponding to a line end: each line is a NUL-terminating C string. > > -- > hundred-and-one symptoms of being an internet addict: > 72. Somebody at IRC just mentioned a way to obtain full motion video without > a PC using a wireless protocol called NTSC, you wonder how you never > heard about it > > /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ > /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ > \\\ an exciting new programming language -- http://www.Zimbu.org /// > \\\ help me help AIDS victims -- http://ICCF-Holland.org /// > > -- > -- > You received this message from the "vim_use" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_use" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
