From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Re: What is the difference between looking-at and an anchored search? Date: Thu, 17 Jul 2008 21:17:49 +0900 Message-ID: References: <487F2985.9080103@gmail.com> Reply-To: Miles Bader NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1216297263 4522 80.91.229.12 (17 Jul 2008 12:21:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 17 Jul 2008 12:21:03 +0000 (UTC) Cc: Emacs Devel To: "Lennart Borgman \(gmail\)" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 17 14:21:50 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 1KJSTu-0002Xb-Iu for ged-emacs-devel@m.gmane.org; Thu, 17 Jul 2008 14:21:10 +0200 Original-Received: from localhost ([127.0.0.1]:41497 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJST1-0005Ol-Ot for ged-emacs-devel@m.gmane.org; Thu, 17 Jul 2008 08:20:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KJSQw-0004CY-KS for emacs-devel@gnu.org; Thu, 17 Jul 2008 08:18:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KJSQu-0004BH-8B for emacs-devel@gnu.org; Thu, 17 Jul 2008 08:18:05 -0400 Original-Received: from [199.232.76.173] (port=57676 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJSQu-0004B4-0W for emacs-devel@gnu.org; Thu, 17 Jul 2008 08:18:04 -0400 Original-Received: from tyo201.gate.nec.co.jp ([202.32.8.193]:41550) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KJSQm-0004Hq-Lw; Thu, 17 Jul 2008 08:17:57 -0400 Original-Received: from relay31.aps.necel.com ([10.29.19.54]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id m6HCHooN024110; Thu, 17 Jul 2008 21:17:50 +0900 (JST) Original-Received: from relay31.aps.necel.com ([10.29.19.20] [10.29.19.20]) by relay31.aps.necel.com with ESMTP; Thu, 17 Jul 2008 21:17:50 +0900 Original-Received: from dhapc248.dev.necel.com ([10.114.112.215] [10.114.112.215]) by relay31.aps.necel.com with ESMTP; Thu, 17 Jul 2008 21:17:50 +0900 Original-Received: by dhapc248.dev.necel.com (Postfix, from userid 31295) id 34187400; Thu, 17 Jul 2008 21:17:50 +0900 (JST) System-Type: i686-pc-linux-gnu Blat: Foop In-Reply-To: <487F2985.9080103@gmail.com> (Lennart Borgman's message of "Thu, 17 Jul 2008 13:14:13 +0200") Original-Lines: 20 X-detected-kernel: by monty-python.gnu.org: Solaris 8 (1) 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:100879 Archived-At: "Lennart Borgman (gmail)" writes: > looking-at does not have a BOUND parameter, but re-search-forward > have. This makes re-search-forward a bit more flexible. > > I am looking at some code where I would have use for that flexibility, > but I wonder if there is any drawback with replacing looking-at with > re-search-forward (with an achored pattern). > > Is there any? Performance? If you want to reject matches that extend past some point, just do something like: (and (looking-at REGEXP) (<= (match-end 0) BOUND)) -Miles -- "Though they may have different meanings, the cries of 'Yeeeee-haw!' and 'Allahu akbar!' are, in spirit, not actually all that different."