Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Demarcate Regexes with Unicode

by moritz (Cardinal)
on Sep 16, 2011 at 07:55 UTC ( #926345=note: print w/replies, xml ) Need Help??

in reply to Demarcate Regexes with Unicode

On one of my machines, two of the characters you proposed aren't displayed correctly, because there's no font installed that contains them.

As a maintainer of code like that I would be unhappy to be faced with characters that I don't know how to produce with the keyboard.

In my humble opinion, the real problem with regex readability is that people tend to not reuse regexes, so everything is pieced together from the primitives.

I find

use Regexp::Common qw /URI/; if ($string =~/$RE{URI}{HTTP}/) { ... }

more readable than any of the alternatives you have offered, and there are no "weird" characters involved.

Replies are listed 'Best First'.
Re^2: Demarcate Regexes with Unicode
by toro (Beadle) on Sep 16, 2011 at 11:41 UTC
    I hadn't heard of Regexp::Common. Awesome! You've just saved me a lot of time moritz, thank you.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://926345]
erix stops reading as recommended by the blog itself
[erix]: my attention being jealously guarded ;)
[shmem]: erix, yes, it's a WTF. Since...
[erix]: antisemitic && (pro-)russian. Makes sense :P
[shmem]: erix: what's antisemitic in there? Tell me.
[erix]: AngloZionist
[shmem]: and it is *not* pro-russian. It describes the western world.
[erix]: I'm not going to read it so I could be mistaken but it reeks of useful idiocy
[shmem]: AngloZionist is not an antisemitic term.
[shmem]: erix: be assured that we all are horribly mistaken, always. What would we write tests for, if not for that fact?

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2018-03-19 20:55 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (246 votes). Check out past polls.