Monday, March 6, 2017

Re: Ambiguity about what $ means?

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. Then replace with XXX
> >
> > instead this happens:
> > 'E486: Pattern $\_.* not found' ?!?
> >
> > does $ not mean what I think it means?
>
> From
>
> :help /$
>
> """
> At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
> matches end-of-line <EOL>; at other positions, matches literal '$'.
> """
>
> As it's not the last character in your regexp, it's looking for a
> literal "$", not an end-of-line.
>

But, you can still match end-of-line in the middle of a pattern using "\n".

--
--
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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: