From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.help Subject: Re: string-match bug? Date: Mon, 14 Dec 2009 14:51:20 +0100 Organization: Organization?!? Message-ID: <87vdg9hdev.fsf@lola.goethe.zz> 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 Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1260802627 31831 80.91.229.12 (14 Dec 2009 14:57:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Dec 2009 14:57:07 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 14 15:57:00 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 1NKCM6-0003sr-9s for geh-help-gnu-emacs@m.gmane.org; Mon, 14 Dec 2009 15:56:59 +0100 Original-Received: from localhost ([127.0.0.1]:52697 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NKCM6-0004Z8-5x for geh-help-gnu-emacs@m.gmane.org; Mon, 14 Dec 2009 09:56:58 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!goblin1!goblin.stu.neva.ru!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) Cancel-Lock: sha1:bbaXdaOkM3lIVUT98Zdv3pZc1X4= Original-Lines: 38 Original-NNTP-Posting-Date: 14 Dec 2009 14:51:20 CET Original-NNTP-Posting-Host: 990fd472.newsspool4.arcor-online.net Original-X-Trace: DXC=Rm_5PAU<21i2?PB31_LiI6ENVa=3>5MOK` 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:70638 Archived-At: Andreas Röhler writes: > Barry Margolin wrote: >> 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. > > 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