I've been playing around with my own RE ops, and I was wondering if
someone can check my logic:

        #this should be equivalent to: "afoooobarz" =~ /f.o*?bar/i
        match "afoooobarz", "i"
RE_1:
        goforward RE_END                #this gives us the behavior of marching
        # forward through the string until we either match or reach the end
        literal "f"                     #any single character
        anything                        #dot
RE_2:
        lazyrepeat                      #if we hit this, and saveindex has saved 
anything,
        # whatever saveindex saved is used as the current index
        literal "o"
        saveindex                       #remember where we are--or if we've failed, 
remember
        # that backtracking won't help (except for that 'goforward' at the
beginning)
        literal "bar"

        backtrack RE_2          #if backtracking is hopeless, make sure you tell the
next op
        # that it isn't; if backtracking isn't hopeless, but the match has
failed, jump to RE_2
        backtrack RE_1
RE_END:
        endre I0                        #sticks the results into I0

        print "Match results: "
        print I0

I'm still getting a few problems with my RE ops, so I can't test it yet.

Thanks,
--Brent Dax
[EMAIL PROTECTED]
Configure pumpking for Perl 6

When I take action, I’m not going to fire a $2 million missile at a $10
empty tent and hit a camel in the butt.
    --Dubya

Reply via email to