all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* regular expression for hiding comment
@ 2009-05-07  6:44 tomer
  2009-05-07  8:20 ` Peter Dyballa
       [not found] ` <mailman.6787.1241684779.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 10+ messages in thread
From: tomer @ 2009-05-07  6:44 UTC (permalink / raw
  To: help-gnu-emacs

i use a language which mark comment with "--".
is want to all lines in all buffer ( grep-buffer regular expression)
that are not comment.
Is it possible ?
Thanks
Tomer


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: regular expression for hiding comment
  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>
  1 sibling, 0 replies; 10+ messages in thread
From: Peter Dyballa @ 2009-05-07  8:20 UTC (permalink / raw
  To: tomer; +Cc: help-gnu-emacs


Am 07.05.2009 um 08:44 schrieb tomer:

> Is it possible ?


Yes. ^.*[^-][^-].*$

--
Greetings

   Pete

Who the fsck is "General Failure," and why is he reading my disk?






^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: regular expression for hiding comment
       [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 19:12     ` Peter Dyballa
  0 siblings, 2 replies; 10+ messages in thread
From: tomer @ 2009-05-07  8:54 UTC (permalink / raw
  To: help-gnu-emacs

On May 7, 11:20 am, Peter Dyballa <Peter_Dyba...@Web.DE> wrote:
> Am 07.05.2009 um 08:44 schrieb tomer:
>
> > Is it possible ?
>
> Yes. ^.*[^-][^-].*$
>
> --
> Greetings
>
>    Pete
>
> Who the fsck is "General Failure," and why is he reading my disk?

I think it is not working


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: regular expression for hiding comment
  2009-05-07  8:54   ` tomer
@ 2009-05-07 12:07     ` Pascal J. Bourguignon
  2009-05-07 13:31       ` tomer
  2009-05-07 19:12     ` Peter Dyballa
  1 sibling, 1 reply; 10+ messages in thread
From: Pascal J. Bourguignon @ 2009-05-07 12:07 UTC (permalink / raw
  To: help-gnu-emacs

tomer <tomer1levin@walla.co.il> writes:

> On May 7, 11:20 am, Peter Dyballa <Peter_Dyba...@Web.DE> wrote:
>> Am 07.05.2009 um 08:44 schrieb tomer:
>>
>> > Is it possible ?
>>
>> Yes. ^.*[^-][^-].*$
>>
>> --
>> Greetings
>>
>>    Pete
>>
>> Who the fsck is "General Failure," and why is he reading my disk?
>
> I think it is not working

The problem is that you didn't say what you wanted to do.  
With computers, anything is possible, if you have infinite memory and
infinite time.

Now you're saying that it is not working.  But you don't tell us what
is not working, what you did, what you expected and what you got?
Do people have telepathic powers in your country?


Of your original post:

> i use a language which mark comment with "--".
> is want to all lines in all buffer ( grep-buffer regular expression)
> that are not comment.
> Is it possible ?
> Thanks
> Tomer

Only the sentence "Is it possible?" is gramatically correct, and can
be parsed to something meaningful, if lacking a context.


-- 
__Pascal Bourguignon__


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: regular expression for hiding comment
  2009-05-07 12:07     ` Pascal J. Bourguignon
@ 2009-05-07 13:31       ` tomer
  2009-05-07 14:19         ` Anselm Helbig
                           ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: tomer @ 2009-05-07 13:31 UTC (permalink / raw
  To: help-gnu-emacs

On May 7, 3:07 pm, p...@informatimago.com (Pascal J. Bourguignon)
wrote:
> tomer <tomer1le...@walla.co.il> writes:
> > On May 7, 11:20 am, Peter Dyballa <Peter_Dyba...@Web.DE> wrote:
> >> Am 07.05.2009 um 08:44 schrieb tomer:
>
> >> > Is it possible ?
>
> >> Yes. ^.*[^-][^-].*$
>
> >> --
> >> Greetings
>
> >>    Pete
>
> >> Who the fsck is "General Failure," and why is he reading my disk?
>
> > I think it is not working
>
> The problem is that you didn't say what you wanted to do.  
> With computers, anything is possible, if you have infinite memory and
> infinite time.
>
> Now you're saying that it is not working.  But you don't tell us what
> is not working, what you did, what you expected and what you got?
> Do people have telepathic powers in your country?
>
> Of your original post:
>
> > i use a language which mark comment with "--".
> > is want to all lines in all buffer ( grep-buffer regular expression)
> > that are not comment.
> > Is it possible ?
> > Thanks
> > Tomer
>
> Only the sentence "Is it possible?" is gramatically correct, and can
> be parsed to something meaningful, if lacking a context.
>
> --
> __Pascal Bourguignon__- Hide quoted text -
>
> - Show quoted text -

Thanks for the reply,
sorry for the unclear question.
I need a regexp which show all line execpt lines which include the
string "--" (the qoute is not part of the sign).
Thanks for the help.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: regular expression for hiding comment
  2009-05-07 13:31       ` tomer
@ 2009-05-07 14:19         ` Anselm Helbig
  2009-05-07 14:32         ` Drew Adams
  2009-05-07 16:07         ` Pascal J. Bourguignon
  2 siblings, 0 replies; 10+ messages in thread
From: Anselm Helbig @ 2009-05-07 14:19 UTC (permalink / raw
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: regular expression for hiding comment
  2009-05-07 13:31       ` tomer
  2009-05-07 14:19         ` Anselm Helbig
@ 2009-05-07 14:32         ` Drew Adams
  2009-05-07 16:07         ` Pascal J. Bourguignon
  2 siblings, 0 replies; 10+ messages in thread
From: Drew Adams @ 2009-05-07 14:32 UTC (permalink / raw
  To: 'tomer', help-gnu-emacs

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

Sounds like you want `M-x flush-lines RET -- RET'.
(The regexp here is just `--'.)





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: regular expression for hiding comment
  2009-05-07 13:31       ` tomer
  2009-05-07 14:19         ` Anselm Helbig
  2009-05-07 14:32         ` Drew Adams
@ 2009-05-07 16:07         ` Pascal J. Bourguignon
  2009-05-07 16:21           ` tomer
  2 siblings, 1 reply; 10+ messages in thread
From: Pascal J. Bourguignon @ 2009-05-07 16:07 UTC (permalink / raw
  To: help-gnu-emacs

tomer <tomer1levin@walla.co.il> writes:
> Thanks for the reply,
> sorry for the unclear question.
> I need a regexp which show all line execpt lines which include the
> string "--" (the qoute is not part of the sign).

Ah, this is clearer.  

Notice that regexp don't 'show' anything, they 'match' input.  It's
the program that use the regexp that may decide to show or hide lines
depending on whether a regexp match them.

Here is such a regexp matching any line but those containing "--":
  
           ^\([^-]\|-[^-]\)*\(\|-\)$


-- 
__Pascal Bourguignon__


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: regular expression for hiding comment
  2009-05-07 16:07         ` Pascal J. Bourguignon
@ 2009-05-07 16:21           ` tomer
  0 siblings, 0 replies; 10+ messages in thread
From: tomer @ 2009-05-07 16:21 UTC (permalink / raw
  To: help-gnu-emacs

On May 7, 7:07 pm, p...@informatimago.com (Pascal J. Bourguignon)
wrote:
> tomer <tomer1le...@walla.co.il> writes:
> > Thanks for the reply,
> > sorry for the unclear question.
> > I need a regexp which show all line execpt lines which include the
> > string "--" (the qoute is not part of the sign).
>
> Ah, this is clearer.  
>
> Notice that regexp don't 'show' anything, they 'match' input.  It's
> the program that use the regexp that may decide to show or hide lines
> depending on whether a regexp match them.
>
> Here is such a regexp matching any line but those containing "--":
>
>            ^\([^-]\|-[^-]\)*\(\|-\)$
>
> --
> __Pascal Bourguignon__

Thanks for the help
I have use hide-lines , i also will try the regexp which is better
choice
Thanks a  a lot


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: regular expression for hiding comment
  2009-05-07  8:54   ` tomer
  2009-05-07 12:07     ` Pascal J. Bourguignon
@ 2009-05-07 19:12     ` Peter Dyballa
  1 sibling, 0 replies; 10+ messages in thread
From: Peter Dyballa @ 2009-05-07 19:12 UTC (permalink / raw
  To: tomer; +Cc: help-gnu-emacs


Am 07.05.2009 um 10:54 schrieb tomer:

> I think it is not working

You're right! I did not test it with incremental regexp search.  
Thinking of it: the greediness of regexp's makes it fail! Since you  
mentioned grep:

	grep -v -e --

will do it. It will also reject lines with more than two -. This  
variant will work exactly:

	egrep -v '[^-]--[^-]'

--
Greetings

   Pete      <\
              _\     O  _
             |o \  _\\_/-\='
_____________(_)|-(_)  (_)___________________________________






^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-05-07 19:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.