in reply to RE: Fun Regex Exercise
in thread Fun Regex Exercise

Bravo (or brava, depending...). My solution was different, but could (and should) have been optimized into yours. Mine uses the notion that any matching string looks like a series of strings like "11..1100..00" concatenated, with a string of 1's at the end. (Or vice-versa, with 0's...) But yours is far simpler -- in fact, it states the very fact: if there's a 1 (or 0) at both ends, the string will succeed. Oh, and no backreferences, but that's ok.

Here's mine. It seems like even more of a behemoth now...
/^((1+0+)*1+|(0+1+)*0+)$/
"Ewww," Tom said sheepishly.

$_="goto+F.print+chop;\n=yhpaj";F1:eval