http://qs1969.pair.com?node_id=197160


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???

-Blake