2016-01-28 23:53 GMT+03:00 Christian Brabandt <[email protected]>:
> Hi Tony!
>
> On Do, 28 Jan 2016, Tony Mechelynck wrote:
>
>> On Thu, Jan 28, 2016 at 9:17 PM, Christian Brabandt 
>> <[email protected]>
>> wrote:
>>
>>
>>     Hm, I think you closed too early. In my opinion an empty glob pattern
>>     should result in an empty regexp
>>
>>
>>
>>
>> Christian, I wouldn't have thought this of you.
>
> I am sorry.
>
>> An empty glob pattern matches only the empty string.
>
> Perhaps I am just confused, but what is an empty glob pattern?
> Is that an empty pattern or a pattern where neither '*' nor '?' occurs?
>
>> An empty Vim pattern matches anything.
>
> Actually an empty Vim pattern matches nothing and Vim falls back and
> uses the previous pattern. In fact after using :let @/='' Vim falls back
> and uses the last substitution pattern. I found that surprising.

No, this is false way of thinking. There are no fallbacks when using
`substitute()`, `match*()`, `search()`: `substitute('abc', '', '1',
'g') is# '1a1b1c1'`. Fall back for `split()` is “split on spaces” and
not “use previous pattern”.

Basically “empty pattern” is a special case in *some* places, each of
them is documented separately. But regex engine compiles empty pattern
to something that has nothing to do with any of the fallbacks.

>
>> So you can't translate one by the other. To match the empty string
>> (with =~ and friends) you need '^$' which is what you already get.
>>
>> Conclusion: It isn't a bug, it's a feature.
>
> I am not sure yet. But I don't have a strong opinion on it either.
>
> Mit freundlichen Grüßen
> Christian
> --
> Das Glück besteht nicht darin, daß du tun kannst, was du willst,
> sondern darin, daß du auch immer willst, was du tust.
>                 -- Leo Nikolajewitsch Tolstoj
>
> --
> --
> You received this message from the "vim_dev" 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_dev" 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_dev" 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_dev" 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.

Raspunde prin e-mail lui