Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

RE: RE: Fun Regex Exercise

by japhy (Canon)
on Oct 25, 2000 at 16:44 UTC ( [id://38348]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://38348]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-24 21:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found