[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RE question
You could reverse the string, do the un-greedy match, then reverse the
result.
_ _ _
Bobby Kleemann <neta.rkleeman@com>
http://www.neta.com/~rkleeman/
On Fri, 2 Apr 1999, Doug Shea wrote:
>
>
> --- Reza Naima <reza.reza@net> wrote:
> > well, this kinda works..
> >
> > $_ = 'comment /* this is a * test dumbass /* */ foo */';
> >
> > m[/\*(.*?)\*/];
> > print "$1\n";
> >
>
> Syntactic differences aside, that's exactly what I already have...
>
> /(\\\*.*?\*\\)/
>
> That's the one that matches from the beginning of the first comment
> to the end of the last comment before the rest of the pattern. The
> un-greedy-ness doesn't help, in this case; there's no way to make it
> BACKWARDS-un-greedy, only FORWARDS un-greedy.
>
> ===
>
> Doug
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free yahoo.@com address at http://mail.yahoo.com
>