[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: string-match bug?
From: |
Juanma Barranquero |
Subject: |
Re: string-match bug? |
Date: |
Tue, 8 Dec 2009 12:35:34 +0100 |
On Tue, Dec 8, 2009 at 11:42, Andreas Röhler
<andreas.roehler@easy-emacs.de> wrote:
> Well, string-match should tell first point of occurrence if any.
This is exactly what it does.
> If we have none, as with slightly changed example
>
> (string-match "xyzzy" "foox-a-yzzybar")
> it duly returns "nil" - and not "0" saying falsly "first point of
> non-occurence"
It returns nil, i.e.: there's no point in the target string at which
the regexp matches.
> (string-match "" "fooxyzzybar") asks, if there is an empty string in string.
> If yes, report the starting point of the empty string.
>
> Does string start with an empty string? IMHO not.
It returns 0, i.e.: this is the point at which the target string
matches ("" will match at the beginning of every string).
It's entirely consistent. You want string-match to answer different
questions in your first and second examples.
Juanma
- string-match bug?, Andreas Roehler, 2009/12/07
- Re: string-match bug?, Colin S. Miller, 2009/12/07
- Re: string-match bug?, Colin S. Miller, 2009/12/07
- Re: string-match bug?, Andreas Röhler, 2009/12/07
- Re: string-match bug?, Matthew Dempsky, 2009/12/07
- Re: string-match bug?, Andreas Röhler, 2009/12/08
- Re: string-match bug?,
Juanma Barranquero <=
- Re: string-match bug?, Peter Münster, 2009/12/08
- Message not available
- Re: string-match bug?, Stefan Monnier, 2009/12/08
- Message not available
- Re: string-match bug?, David Kastrup, 2009/12/14
- Message not available
- Re: string-match bug?, Barry Margolin, 2009/12/07
- Re: string-match bug?, Andreas Röhler, 2009/12/08
- Re: string-match bug?, Peter Dyballa, 2009/12/08
- Re: string-match bug?, Andreas Röhler, 2009/12/08
- Message not available
- Re: string-match bug?, Barry Margolin, 2009/12/08
- Re: string-match bug?, Pascal J. Bourguignon, 2009/12/08
- Re: string-match bug?, Stefan Monnier, 2009/12/09