Re: Ambiguity about what $ means?

2017-03-07 Thread Tony Mechelynck
On Mon, Mar 6, 2017 at 9:20 PM, Nikolay Aleksandrovich Pavlov wrote: [...] > 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 argumen

Re: Ambiguity about what $ means?

2017-03-06 Thread Nikolay Aleksandrovich Pavlov
2017-03-06 23:09 GMT+03:00 Bram Moolenaar : > > Shawn Corey wrote: > >> On Mon, 6 Mar 2017 08:01:58 -0800 (PST) >> Ben Fritz 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

Re: Ambiguity about what $ means?

2017-03-06 Thread Bram Moolenaar
Shawn Corey wrote: > On Mon, 6 Mar 2017 08:01:58 -0800 (PST) > Ben Fritz 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 call

Re: Ambiguity about what $ means?

2017-03-06 Thread Tim Chase
On 2017-03-06 08:01, Ben Fritz wrote: > On Sunday, March 5, 2017 at 1:55:19 PM UTC-6, Tim Chase wrote: >> On 2017-03-05 09:20, Pablo Contreras wrote: >>> s/$/XXX/ >> [snip] >>> s/$\_.*/XXX/ >> From >> >> :help /$ >> >> """ >> At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): >>

Re: Ambiguity about what $ means?

2017-03-06 Thread Shawn H Corey
On Mon, 6 Mar 2017 08:01:58 -0800 (PST) Ben Fritz 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 differe

Re: Ambiguity about what $ means?

2017-03-06 Thread Ben Fritz
On Sunday, March 5, 2017 at 1:55:19 PM UTC-6, Tim Chase wrote: > On 2017-03-05 09:20, Pablo Contreras wrote: > > s/$/XXX/ > [snip] > > s/$\_.*/XXX/ > > > > apparently should match 'end-of-line, then using \_. any char > > including enf-of-line as many times as necessary to the end of the > > file

Re: Ambiguity about what $ means?

2017-03-05 Thread Tim Chase
On 2017-03-05 09:20, Pablo Contreras wrote: > s/$/XXX/ [snip] > s/$\_.*/XXX/ > > apparently should match 'end-of-line, then using \_. any char > including enf-of-line as many times as necessary to the end of the > file. Then replace with XXX > > instead this happens: > 'E486: Pattern $\_.* not

Ambiguity about what $ means?

2017-03-05 Thread Pablo Contreras
Hi, I am trying to match midway through a line and then continue to the rest of the file but it seems I am not allowed. so say I have = 1. 2. mary 3. 4. had a little lamb = I am on line 2, right at the beginning Let's say I do: s/$/XXX/ I get = 1. 2. maryXXX 3. 4. had a litt