unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Anselm Helbig <anselm.helbig+news2009@googlemail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: regular expression for hiding comment
Date: Thu, 07 May 2009 16:19:43 +0200	[thread overview]
Message-ID: <87bpq5j8qo.wl%anselm.helbig+news2009@googlemail.com> (raw)
In-Reply-To: <d60d4b40-55ab-4b43-87bd-14d97daa024c@s16g2000vbp.googlegroups.com>

Hi!

> I need a regexp which show all line execpt lines which include the
> string "--" (the qoute is not part of the sign).

Generally, RegExps suck at "negative matching". You'd rather have a
regexp match all lines that are comments and then do something to the
other lines. There's M-x flush-lines for example, and M-x grep calls
out to the external grep program that has the `-v'-switch. 

It might be possible to construct a regex that does what you want.
Unfortunately, this isn't so easy and Peter's solution is definitely
wrong - it matches any line that contains two adjacent non-dash
characters.  I don't have a quick answer to that one neither - nice
brain teaser. 8-)

HTH, 

Anselm


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


  reply	other threads:[~2009-05-07 14:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-07  6:44 regular expression for hiding comment tomer
2009-05-07  8:20 ` Peter Dyballa
     [not found] ` <mailman.6787.1241684779.31690.help-gnu-emacs@gnu.org>
2009-05-07  8:54   ` tomer
2009-05-07 12:07     ` Pascal J. Bourguignon
2009-05-07 13:31       ` tomer
2009-05-07 14:19         ` Anselm Helbig [this message]
2009-05-07 14:32         ` Drew Adams
2009-05-07 16:07         ` Pascal J. Bourguignon
2009-05-07 16:21           ` tomer
2009-05-07 19:12     ` Peter Dyballa

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87bpq5j8qo.wl%anselm.helbig+news2009@googlemail.com \
    --to=anselm.helbig+news2009@googlemail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).