[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: string-match bug?
From: |
Barry Margolin |
Subject: |
Re: string-match bug? |
Date: |
Mon, 07 Dec 2009 22:22:06 -0500 |
User-agent: |
MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
In article <mailman.12469.1260221021.2239.help-gnu-emacs@gnu.org>,
Matthew Dempsky <matthew@dempsky.org> wrote:
> On Mon, Dec 7, 2009 at 12:37 PM, Andreas Röhler
> <andreas.roehler@easy-emacs.de> 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.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
- Re: string-match bug?, (continued)
- Re: string-match bug?, Pierre Lorenzon, 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, 2009/12/08
- 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 <=
- 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
- Re: string-match bug?, Matthew Dempsky, 2009/12/08
- Re: string-match bug?, Andreas Röhler, 2009/12/09
- Re: string-match bug?, Juanma Barranquero, 2009/12/09
- Re: string-match bug?, Andreas Röhler, 2009/12/09