[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: Kevin Dziulko
Subject: Re: Finding C style comments using isearch-forward-regexp
Date: Fri, 21 Feb 2003 09:00:09 -0500 (EST)

On Thu, 20 Feb 2003, Kai Großjohann wrote:

> "Stefan Monnier <>" 
> <> writes:
> >> - any sequence of [^*] is allowed
> >> - a * followed by [^/] is allowed
> >> The above two can be repeated.
> >> I think that avoids backtracking.
> >
> > It will avoid matching past the comment-end, but it doesn't prevent the
> > regexp routines from pushing stuff on the stack in case we need
> > to backtrack (the routines are not clever enough).
> Hm.  Does that mean that even, say, .* on a file with a single very
> long line will put too much stuff on the stack?
> Is there a way to tell the routines to never backtrack?  I think
> there is a way for Perl, and Perlish things went into the Emacs
> regexp engine...

The regexp /*[^\(*/\)]*/ will find C comments in a non-greedy fashion.
Does this help your stack problems?

reply via email to

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