Monday, March 6, 2017

Re: Ambiguity about what $ means?

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):
>> 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".

Which the OP mentions trying/using:

> On 2017-03-05 09:20, Pablo Contreras wrote:
> because oddly when I wrote:
>
> s/\n\_.*/XXX/
>
> it exactly gives:
>
> =====
> 1.
> 2. maryXXX
> =====
>
> which you would expect.


:-)

-tim



--
--
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:

Post a Comment