[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20307: 25.0.50; (regexp-opt nil ...) returns ""

From: Artur Malabarba
Subject: bug#20307: 25.0.50; (regexp-opt nil ...) returns ""
Date: Mon, 13 Apr 2015 16:59:36 +0100

I believe you. Please ignore this babbling baboon.
That's what I get for typing on the bus.

On Apr 13, 2015 4:34 PM, "David Kastrup" <address@hidden> wrote:
Artur Malabarba <address@hidden> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]