From: Jim Gibson <jimsgib...@gmail.com>
> At 9:18 PM -0400 3/29/11, Chas. Owens wrote:
> 
> >It is important to note that \d
> >doesn't match what you think it does.  Starting with Perl 5.8, \d
> >matches and digit character.  This includes characters such as
> >"\x{1815}" (Mongolian digit five).  To match the ASCII digit
> >characters you must use [0-9]:
>
> I have heard this advice before, and it just sounds silly to me. I 
> deal exclusively with ASCII characters, so \d will only match the 
> characters '0' through '9'. If any UTF characters have crept into my 
> data unknowingly, then I have a bigger problem than too many matches. 
> If I am dealing with Monogolian characters or with any other set of 
> UTC characters, then I certainly want \d to match them as well. There 
> is a good reason why the set of characters matched by \d was expanded.

The \d had been rendered useless. \d had meant 
"something I can do math with" for too long to be changed to "something 
someone might consider a digit". Which if it was to be correct would include 
the roman numerals "I, V, X, L, C, D, M, ..." 

Hey, it doesn't, \d is wrong even according to the silly new definition!

The "anything that might be considered a digit in Unicode" they should have 
used some \N{} or \p{} and leave the \d alone.

Yes, if you happened to want to match the mongolian digit thirteen 
you would have to use \p{IsDigit} or something. Huge deal. 

Instead of forcing those few and far apart that need (for whatever 
reason that completely alludes me) to match anything resembling a 
digit to use the Unicode \p{} construct or something similar, 
everyone had been forced to change their code to prevent their 
regexps suddenly matching something they never meant to match and 
that the computer will have no use for. So much for backwards 
compatibility.

Jenda
===== je...@krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to