[Top][All Lists]

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

Re: Finding C style comments using isearch-forward-regexp

From: Kai Großjohann
Subject: Re: Finding C style comments using isearch-forward-regexp
Date: Wed, 19 Feb 2003 20:01:58 +0100
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3.50

Timur Aydin <> writes:

> I am struggling to find C style comments using the
> isearch-forward-regexp function (C-M-s). Here is the regexp that I am
> using:
> /\*\(.\|^J\)*\*/
> Basically, I am telling emacs to first find the opening comment "/*",
> then any number of any character or newline and then the closing
> comment "*/".
> However, immediately after typing the * after the closing parenthesis,
> emacs tells me:
> [(error stack overflow in regexp matcher)]

I created a buffer foo.c and entered the following:

int main(int argc, char** argv)
    /* A comment for testing. */
    printf("hello, world\n");

Then I went to the beginning of the buffer, entered C-M-s, the regexp
you cited, and it found the comment just nicely.

(Note that your regexp will find too much: if there are two comments,
then it will find everything from the start of the first to the end
of the second comment.)
A turnip curses Elvis

reply via email to

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