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

Re: RE question



But this one wouldn't match

/* Yadda  /
 * Yadda  /
 * Yadda */

This is probably going ot have to be done in a multi-stage attempt.

... =~ m!
	(/\*  # Begin comment
	.*?   # Match everything except *'s
	\*/)  # End comment
	# Rest of function matching code.
!sx;

while (m!(\*/)!sg > 1) {
	# If there is any nested comments, remove them.
	s!.*/\*.*?\*/!!s;
}

 _ _ _
 Bobby Kleemann <neta.rkleeman@com>
 http://www.neta.com/~rkleeman/

On Thu, 1 Apr 1999, Dan Haskovec wrote:

> $foo =~ m|/\*[^*/]*\*/|;
> 
> Also look at the concept of "greedy matching," can't remember the operator
> for that exactly. That way you could just match the first close comment.
> 
> dan
> 
> 
> On Thu, 1 Apr 1999, Doug Shea wrote:
> 
> >     So what I'm getting at here, I want to match an open comment ("/*"),
> > then anything that DOESN'T include an open comment, then a close comment
> > ("*/"). I think that'll do it, but I don't know how to specify an RE
> > that means "anything that doesn't include"...
>