in reply to Regex refresher
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???
|Replies are listed 'Best First'.|
Re(2): Regex refresher
by Arien (Pilgrim) on Sep 12, 2002 at 09:02 UTC
by blakem (Monsignor) on Sep 12, 2002 at 09:56 UTC
In Section Meditations