all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Doug Lewan <dougl@shubertticketing.com>
To: Rivka Miller <rivkaumiller@gmail.com>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: RE: Quickie - Regexp for a string not at the beginning of the line
Date: Fri, 26 Oct 2012 12:02:47 +0000	[thread overview]
Message-ID: <155DEC68569B714B86C2C7075F5EDA9826952BDF@DAKIYA1.pegasus.local> (raw)
In-Reply-To: <CAJsNXTkcmpjCwTpWr6T+eqhDWnnu-mntNuNT0W=SvWavbHsKVA@mail.gmail.com>

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.



  reply	other threads:[~2012-10-26 12:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <9eba5652-f814-41fa-83e4-460bca2be264@n16g2000yqi.googlegroups.com>
     [not found] ` <e6f60702-d85f-4aed-bc03-3147bb007ad8@googlegroups.com>
2012-10-26  1:08   ` Quickie - Regexp for a string not at the beginning of the line Rivka Miller
2012-10-26  2:00     ` Ed Morton
2012-10-26  2:11     ` Ben Bacarisse
2012-10-26  4:45       ` Rivka Miller
2012-10-26 12:11         ` Ben Bacarisse
2012-10-26 12:32         ` Ed Morton
2012-10-26  2:19     ` PJ Weisberg
2012-10-26 12:02       ` Doug Lewan [this message]
2012-10-26  3:22     ` anon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=155DEC68569B714B86C2C7075F5EDA9826952BDF@DAKIYA1.pegasus.local \
    --to=dougl@shubertticketing.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=rivkaumiller@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.