From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Doug Lewan Newsgroups: gmane.emacs.help Subject: RE: Quickie - Regexp for a string not at the beginning of the line Date: Fri, 26 Oct 2012 12:02:47 +0000 Message-ID: <155DEC68569B714B86C2C7075F5EDA9826952BDF@DAKIYA1.pegasus.local> References: <9eba5652-f814-41fa-83e4-460bca2be264@n16g2000yqi.googlegroups.com> <73f60cf3-d932-4366-a405-6767488560c6@q16g2000yqc.googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1351252933 17967 80.91.229.3 (26 Oct 2012 12:02:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Oct 2012 12:02:13 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org" To: Rivka Miller Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 26 14:02:19 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TRicF-0005rs-EB for geh-help-gnu-emacs@m.gmane.org; Fri, 26 Oct 2012 14:02:19 +0200 Original-Received: from localhost ([::1]:48527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRic7-0007bs-M5 for geh-help-gnu-emacs@m.gmane.org; Fri, 26 Oct 2012 08:02:11 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRibv-0007b8-Ss for help-gnu-emacs@gnu.org; Fri, 26 Oct 2012 08:02:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TRibo-0003c3-5S for help-gnu-emacs@gnu.org; Fri, 26 Oct 2012 08:01:59 -0400 Original-Received: from webmail.shubertorg.com ([207.246.209.200]:50417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRibo-0003bm-2Z for help-gnu-emacs@gnu.org; Fri, 26 Oct 2012 08:01:52 -0400 Original-Received: from dakiya1.pegasus.local ([::1]) by DAKIYA1.pegasus.local ([::1]) with mapi id 14.01.0339.001; Fri, 26 Oct 2012 08:02:48 -0400 Thread-Topic: Quickie - Regexp for a string not at the beginning of the line Thread-Index: AQHNsxbL7um7hiauDU6Ny12IJvhScJfLHXKAgABet4A= In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.0.21.202] X-detected-operating-system: by eggs.gnu.org: Windows XP/2000 (RFC1323+, w+, tstamp-) X-Received-From: 207.246.209.200 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:87444 Archived-At: Or simply make sure the RE that you're using has an [uninteresting] charact= er before the [interesting] part. v (while (re-search-forward ".\\(interesting\\)+" (point-max) t) (replace-match "MORE interesting" t t nil 1)) I hope this helps. From: help-gnu-emacs-bounces+dougl=3Dshubertticketing.com@gnu.org [mailto:h= elp-gnu-emacs-bounces+dougl=3Dshubertticketing.com@gnu.org] On Behalf Of PJ= Weisberg Sent: Thursday, 2012 October 25 22:19 To: Rivka Miller Cc: help-gnu-emacs@gnu.org Subject: Re: Quickie - Regexp for a string not at the beginning of the line On Thursday, October 25, 2012, Rivka Miller wrote: > Hello Programmers, > > I am looking for a regexp for a string not at the beginning of the > line. > > For example, I want to find $hello$ that does not occur at the > beginning of the string, ie all $hello$ that exclude ^$hello$. How about a zero-width lookbehind for any character? --=20 -PJ Gehm's Corollary to Clark's Law: Any technology distinguishable from magic is insufficiently advanced.