Finding the intersection between two regexes

Hakim C hakim.cassimally at gmail.com
Fri Apr 25 09:08:26 BST 2014


On 25 April 2014 06:38, Abigail <abigail at abigail.be> wrote:

> On Fri, Apr 25, 2014 at 12:47:04AM +0100, David Cantrell wrote:
> I'm with Mark. My view is that a /\d/ is almost always wrong, on any perl
> released in this century.
>
> /\d/a or /(?a:\d)/ is just a really ugly and confusing way to write
> /[0-9]/.
> I bet most Perl programmers [1] won't know what /a does, let alone know the
> difference between /a and /aa.
>

​That said, [0-9] is an ugly and error-prone way to write something that
used to be simply \d.  I recently had fun spotting what I'd done wrong with
something along the lines of /[0-9]{2}:[0-8]{2}:[0-9]:{2}/​.  Changing the
semantics of \d was a Really Bad Idea.

osf'


More information about the london.pm mailing list