Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Don't ask to ask, just ask
 
PerlMonks  

RE: Regexes vs. Maintainability

by japhy (Canon)
on Sep 28, 2000 at 20:16 UTC ( [id://34485]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Regexes vs. Maintainability

Well, I'll say you're going a bit overboard with the whitespace before your regex there... but anyway.

Break your regex into parts:
$d5 = qr/\d{0,5}/; $d6 = qr/\d{1,6}/; $d7 = qr/\d{1,7}/; $number =~ m{( $d5\.$d6 | $d6\.$d5 | $d7 )};


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

Replies are listed 'Best First'.
(Ovid) RE(2): Regexes vs. Maintainability
by Ovid (Cardinal) on Sep 28, 2000 at 21:12 UTC
    Hmm... I had posted this in discussion, since seekers didn't seem appropriate. Ah well.

    I like your version of the second regex. Not sure about the comment regarding going overboard on the whitespace. I prefer the extra whitespace because I feel the indentation adds clarity (especially in the comments, oddly enough). Too many programmers just throw things to gether with little or no explanation. I err on the side of overcommenting, but my programs are, I think, much easier to understand.

    What don't you like about the whitespace?

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just go the the link and check out our stats.

      You were indenting REALLY far in. It just made it seem more trouble than it was worth. If you use tabs in your actual code, you may want to consider changing to two or four spaces instead.

      $_="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://34485]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.