[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RE question
On Thu, Apr 01, 1999 at 04:03:52PM -0800, Dan Haskovec sent me this...
> $foo =~ m|/\*[^*/]*\*/|;
are you sure you can put multiple things in the [^], from my understanding,
it will match anything but any of those characaters.. so if you have a * or
/, it will stop at that point -- not when it seems both.. not sure about
this though.
>
> 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.
you want to use ?, the non-greedy modifier operator.
also, for your original example, use x -- it makes things a lot easier to
read... i.e.
m!^(\S+)\s # HOST
(\S+)\s # LOGNAME
(\S+)\s # REMOTESUER
\[([^\]]+)\]\s # TIME
\"([^\"]+)\"\s # REQUEST "
(\S+)\s # STATUS
(\S+)\s # BYTES
(\S+)\s # REFER
(.*)$!x
guess what thst's for
--reza
>
> 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"...