help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: regular expression for hiding comment


From: Anselm Helbig
Subject: Re: regular expression for hiding comment
Date: Thu, 07 May 2009 16:19:43 +0200
User-agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.7 Emacs/22.3 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]