Finding the intersection between two regexes

David Cantrell david at cantrell.org.uk
Fri Apr 25 22:15:31 BST 2014


On Fri, Apr 25, 2014 at 12:37:17PM -0400, Mark Fowler wrote:
> David Cantrell wrote:
> > I require no such blood sacrifice for my code, but do insist that
> > the tests still pass on perl 5.8.8.
> That makes sense.  So we sadly can't use /a.

Although you can use fancy new features in the build scripts.

> Ideally we'd want to munge the \d into [0-9].  It's as easy as
> s/\\d/[0-9]/g, but that's relying on google to never use some
> constructs in their regular expression (i.e. they don't put \\d in
> their own regular expression.)

There's very little chance of that happening. Backslashes and letters
can't appear in phone numbers anyway.

Go fer it!

On Fri, Apr 25, 2014 at 10:24:57PM +0200, Abigail wrote:

> Do a pre-check? Reject anything that contains a non-ASCII character flatout.

That would be another option. Perhaps a better one, as it'll mean I
won't have to remember to eschew \d in future.

-- 
David Cantrell | even more awesome than a panda-fur coat

You may now start misinterpreting what I just
wrote, and attacking that misinterpretation.


More information about the london.pm mailing list