From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: string-match bug? Date: Mon, 07 Dec 2009 22:22:06 -0500 Organization: A noiseless patient Spider Message-ID: References: <4b1d1a48$0$278$14726298@news.sunsite.dk> <4b1d1e3d$0$276$14726298@news.sunsite.dk> <4B1D6773.3000509@easy-emacs.de> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1260243653 30320 80.91.229.12 (8 Dec 2009 03:40:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Dec 2009 03:40:53 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 08 04:40:47 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NHqwO-0005He-Jn for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Dec 2009 04:40:44 +0100 Original-Received: from localhost ([127.0.0.1]:41624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NHqwO-0000cA-8f for geh-help-gnu-emacs@m.gmane.org; Mon, 07 Dec 2009 22:40:44 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!feeder.eternal-september.org!eternal-september.org!barmar.motzarella.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 28 Original-X-Trace: news.eternal-september.org U2FsdGVkX1/tonUmFgZ0E79RE+Dn3dWfo5RpP0MThHHFlPhPfCHWDyxYLg9mW8O6OSa4wrL5ellZknc/3GcY0aWWG1L1NomCTfTh8pvOPAM72gSjZuHoBY3m5imEV5O0t57KfR6fsR4= Original-X-Complaints-To: abuse@eternal-september.org Original-NNTP-Posting-Date: Tue, 8 Dec 2009 03:22:05 +0000 (UTC) User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) X-Auth-Sender: U2FsdGVkX18xfG47uNtkPXyEPvnISB8C19fRJBJTU98= Cancel-Lock: sha1:j8HTfc/obECBj9kYkbxSn+hxpxU= Original-Xref: news.stanford.edu gnu.emacs.help:175412 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:70488 Archived-At: In article , Matthew Dempsky wrote: > On Mon, Dec 7, 2009 at 12:37 PM, Andreas Röhler > 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 ***