![]() |
|
Keep It Simple, Stupid | |
PerlMonks |
Re: Regex refresherby blakem (Monsignor) |
on Sep 12, 2002 at 07:23 UTC ( #197160=note: print w/replies, xml ) | Need Help?? |
Heh, looks like it will match every string in the world to me. Were there supposed to be anchors on the ends?
Update: With anchors, it will match binary numbers divisible by 3. though I haven't figured out exactly why.
Update: Here's a couple hints though. Left shifting a number divisible by 3 yields another number that is divisible by three. Adding two such numbers (obviously) still preserves this property. The innermost part of the regex is still a stumper though... What kind of bits match /^(01*0)*$/, and why can you shove them between two '1's and get a number divisible by 3??? -Blake
In Section
Meditations
|
|