[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Quickie - Regexp for a string not at the beginning of the line
From: |
Doug Lewan |
Subject: |
RE: Quickie - Regexp for a string not at the beginning of the line |
Date: |
Fri, 26 Oct 2012 12:02:47 +0000 |
Or simply make sure the RE that you're using has an [uninteresting] character
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=shubertticketing.com@gnu.org
[mailto:help-gnu-emacs-bounces+dougl=shubertticketing.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 <rivkaumiller@gmail.com> 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?
--
-PJ
Gehm's Corollary to Clark's Law: Any technology distinguishable from
magic is insufficiently advanced.