[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#20307: 25.0.50; (regexp-opt nil ...) returns ""
From: |
David Kastrup |
Subject: |
bug#20307: 25.0.50; (regexp-opt nil ...) returns "" |
Date: |
Mon, 13 Apr 2015 17:34:34 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Artur Malabarba <bruce.connor.am@gmail.com> writes:
> 2015-04-12 10:50 GMT+01:00 David Kastrup
>> Both
>>
>> M-: (regexp-opt nil) RET
>>
>> and
>>
>> M-: (regexp-opt nil t) RET
>>
>> return "". However, they should return a regexp matching nothing
>> rather than everything, and the second invocation should also count as
>> one () pairing.
>
> I agree there should be () on the second one, but I strongly disagree
> they should match nothing.
>
> regexp-opt is NOT meant to match only the given strings. It is meant
> to match anything containing the given strings.
Well, and no string to match has been given. This is not
(regexp-opt '(""))
but rather
(regexp-opt '())
> There is a very fundamental difference in that. The less strings you
> pass to regexp-opt, the MORE things the regexp will match.
Come again?
> Why would we suddently flip that on its head when going from 1 to 0
> strings?
(regexp-opt '("a" "b" "c")) -> "[abc]"
(regexp-opt '("a" "b")) -> "[ab]"
Quite literally (execute C-x C-e after the expressions above if you
don't believe me). So how does "[ab]" match more than "[abc]" ?
--
David Kastrup