From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman" Newsgroups: gmane.emacs.devel Subject: Re: What is the difference between looking-at and an anchored search? Date: Thu, 17 Jul 2008 14:42:04 +0200 Message-ID: References: <487F2985.9080103@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_31844_15918183.1216298524429" X-Trace: ger.gmane.org 1216298559 9742 80.91.229.12 (17 Jul 2008 12:42:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 17 Jul 2008 12:42:39 +0000 (UTC) Cc: Emacs Devel To: "Miles Bader" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 17 14:43:22 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KJSp7-0004t9-AK for ged-emacs-devel@m.gmane.org; Thu, 17 Jul 2008 14:43:05 +0200 Original-Received: from localhost ([127.0.0.1]:55010 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJSoE-0004w8-Nx for ged-emacs-devel@m.gmane.org; Thu, 17 Jul 2008 08:42:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KJSoA-0004vo-FU for emacs-devel@gnu.org; Thu, 17 Jul 2008 08:42:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KJSoA-0004vc-0Q for emacs-devel@gnu.org; Thu, 17 Jul 2008 08:42:06 -0400 Original-Received: from [199.232.76.173] (port=37113 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJSo9-0004vZ-Uj for emacs-devel@gnu.org; Thu, 17 Jul 2008 08:42:05 -0400 Original-Received: from fg-out-1718.google.com ([72.14.220.154]:30810) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KJSo9-0006Ll-At for emacs-devel@gnu.org; Thu, 17 Jul 2008 08:42:05 -0400 Original-Received: by fg-out-1718.google.com with SMTP id l26so2792832fgb.30 for ; Thu, 17 Jul 2008 05:42:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=TcTyk96/1ECWz6/MYiwmQwnOdboz/p5nvCeU+TTghno=; b=CCVIWEzB0uZT2mCIeZ3naCiRVrMcJGqranKZK0q5nCZwS+xQ1yQRX9EAemFcz6vz/B 2uw7nezSf92Xz/lyWRDoop8I2XdYkKoEOtfE+cik0LaBJBPUaDLQ2q8SG8AfzYg3Qzfp 8ft6cT4Vah03XGzWxKjbXXPeFgJ3PjjnSuboI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=TZEdlzc0oThDfSK/8r0JlyOmNtzQTpT5Ghg1VDDEf1Dc6nmqMFPba2FFL1FtzMuSok mexSamSoWAAIFH/HnW0kBscMGoV6n92zqCFySpEYZTG+Rd4DpgDy3dguuO/zeZ2VhVKP Iz82oZeKtkmETnQSSDHnuLbsO61nwUPa0i6Tg= Original-Received: by 10.86.31.18 with SMTP id e18mr3926267fge.52.1216298524429; Thu, 17 Jul 2008 05:42:04 -0700 (PDT) Original-Received: by 10.86.66.2 with HTTP; Thu, 17 Jul 2008 05:42:04 -0700 (PDT) In-Reply-To: X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:100885 Archived-At: ------=_Part_31844_15918183.1216298524429 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 7/17/08, Miles Bader wrote: > > "Lennart Borgman" writes: > >> If you want to reject matches that extend past some point, just do > >> something like: > >> > >> (and (looking-at REGEXP) (<= (match-end 0) BOUND)) > > > > Thanks Miles, > > > > Yes, that is one possibility. But then perhaps I would assume that > > re-search-forward better might optimize that search since it can (in > theory) > > cut off the searching at BOUND. In the case I am looking at performance > is > > important. > > Why don't you time it? Because I thought someone here knew more about the performance differences (if any). I am also a bit surprised that looking-at does not have a BOUND parameter and hoped to get some comments on that. But otherwise it is of course a good suggestion to time it. ------=_Part_31844_15918183.1216298524429 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
On 7/17/08, Miles Bader <miles.bader@necel.com> wrote:
"Lennart Borgman" <lennart.borgman@gmail.com> writes:
>> If you want to reject matches that extend past some point, just do
>> something like:
>>
>>   (and (looking-at REGEXP) (<= (match-end 0) BOUND))
>
> Thanks Miles,
>
> Yes, that is one possibility. But then perhaps I would assume that
> re-search-forward better might optimize that search since it can (in theory)
> cut off the searching at BOUND. In the case I am looking at performance is
> important.

Why don't you time it?
 
Because I thought someone here knew more about the performance differences (if any). I am also a bit surprised that looking-at does not have a BOUND parameter and hoped to get some comments on that.
 
But otherwise it is of course a good suggestion to time it.
------=_Part_31844_15918183.1216298524429--