[Top][All Lists]

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

Re: string-match bug?

From: David Kastrup
Subject: Re: string-match bug?
Date: Mon, 14 Dec 2009 14:51:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Andreas Röhler <address@hidden> writes:

> Barry Margolin wrote:
>> In article <address@hidden>,
>>  Matthew Dempsky <address@hidden> wrote:
>>> On Mon, Dec 7, 2009 at 12:37 PM, Andreas Röhler
>>> <address@hidden> wrote:
>>>> Why should questioned string respond here it contains an empty string at 
>>>> position 0?
>>>> Makes no sense for me.
>>> Here's an analogy: (string-match "xyzzy" "fooxyzzybar") returns 3.
>>> This is because the first 5 characters starting at position 3 are
>>> "xyzzy", the same as the first string parameter.  The significance of
>>> 5 here is the length of "xyzzy".
>>> Similarly, (string-match "" "foo") returns 0.  This is because the
>>> first 0 characters starting at position are "", the same as the first
>>> string parameter.
>> Here's another example of a limit case:
>> (string-match "a*" "b") returns 0, because a* matches zero or more a's, 
>> and there are zero a's at position 0.
> Hmm, interesting
> IMHO that differs:
> Still pretending: the empty string can't match any non-empty string,
> at no position...

Since (concat "" "foo")->"foo", obviously "" is contained in "foo" at
position 0.  The same argument holds for any other position.  Including
after the last character.

David Kastrup

reply via email to

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