in reply to Re: Should be a simple spaces/digits regex....but I'm turning grey! (?=)
in thread Should be a simple spaces/digits regex....but I'm turning grey!

  Note that I always use [0-9] and never \d as, these days, \d includes tons of characters besides '0'..'9'.

Only if you let it :) use (?a) or /a its ASCII-restrict (or ASCII-safe);

  • Comment on Re^2: Should be a simple spaces/digits regex....but I'm turning grey! (?=)
  • Download Code

Replies are listed 'Best First'.
Re^3: Should be a simple spaces/digits regex....but I'm turning grey! (/a)
by tye (Sage) on Aug 05, 2014 at 02:36 UTC

    Yeah, if you've got a version of Perl that supports such. Way too many versions of Perl after \d began including Klingon* digits yet before /a was implemented.

    Plus, /a messes with more than just \d. I have yet to run into a single project I was involved in where a string of Klingon* digits would be correctly parsed as a numeric value. But I've touched plenty of projects where \w including more letters than a-z was quite useful. Perl itself is that way, after all. Sure, you could write (?a:\d) but that's just longer and less clear (and less portable).

    So I suspect I'll be sticking with [0-9] for quite a while still.

    * No, Unicode doesn't actually include Klingon (yet, anyway).

    - tye