We don't bite newbies here... much | |
PerlMonks |
Re: Re: Re: Re: Regex refresher (help?)by zakb (Pilgrim) |
on Sep 13, 2002 at 09:14 UTC ( [id://197486]=note: print w/replies, xml ) | Need Help?? |
See FoxtrotUniform's answer above. 101 is not matched. As for your other problems, here's a solution to one of them which should help with the others: For reference, the original regex was:
Let's take your first example: 0011. 0 matches the first branch, and the final asterisk right at the end makes that greedy, so it also matches the second 0. 1 matches the second branch, the (01*0) matches nothing - which is ok because of the asterisk right after it. This effectively reduces the second branch to 1*1, which matches 11. The others (1100, 0110) are variations on this theme.
In Section
Meditations
|
|