I figured that (I actually did it, in a less-pretty form, in my early Perl days when I wrote a syntax highlighter for my website). So there's no elegant way the new regexes support it? That's a shame.
But I see now how state objects are a very cool idea. Oh, and I'd just thought I'd let everyone know: I'm writing a vim syntax highlighting file for Perl 6 at the moment. I'll post it when it's in an acceptable state. > Borrow this trick from Parse::RecDescent: > > rule max (*@candidates) {{ > my $best; > my $startpos = .pos; > for @candidates -> $next { > .pos = $startpos; > $best = $0 if /<$next>/ && $best && $0.length < $best.length { > } > fail unless $best; > let $0 := $best; > .pos = $best.pos; > }} > > then: > > "bacamus" =~ / <max(/b.*a/, /b.*s/)> /; > > > Damian Luke -- Base 8 is just like base 10 really... if you're missing two fingers. --Tom Lehrer, "New Math"