News for hackers. Stuff that matters.
Re:Why Using .* in Regular Expressions Is Almost Never What ... by Mithaldu on Wednesday June 04, 2014 @09:34AM (#7845409)
Be aware though that \d will also find arabic or roman numerals. :)
Re:Why Using .* in Regular Expressions Is Almost Never What ... by mhaymo on Wednesday June 04, 2014 @09:57AM (#7845533)
Roman numerals? I have never encountered a regex implementation where '\d' matches 'X'. It's certainly not the case for Javascript: http://regexpal.com/?flags=g&regex=\d%2B&input=10%0Ax%0AX%0A...
Re:Why Using .* in Regular Expressions Is Almost Never What ... by mmastrac on Wednesday June 04, 2014 @10:06AM (#7845590)
There's a whole lot of these numeral characters in unicode, for example:

http://www.charbase.com/2169-unicode-roman-numeral-ten

(even more in http://www.charbase.com/block/number-forms)

I'm not sure if Javascript matches these in its \d pattern, however, but I think that most regexp engines default to the ascii [0-9] unless you are using \p{Number}.

Re:Why Using .* in Regular Expressions Is Almost Never What ... by pyre on Wednesday June 04, 2014 @11:06AM (#7845953)
There's also the character classes in Unicode:

http://www.fileformat.info/info/unicode/category/index.htm

Re:Why Using .* in Regular Expressions Is Almost Never What ... by fennecfoxen on Wednesday June 04, 2014 @10:55AM (#7845862)
> /\d/.test("\u2169")

false

Re:Why Using .* in Regular Expressions Is Almost Never What ... by jaredmcateer on Wednesday June 04, 2014 @10:59AM (#7845896)
Ruby also does not match roman numerals with \d

http://rubular.com/r/bOCmLIfKdZ

Re:Why Using .* in Regular Expressions Is Almost Never What ... by UweSchmidt on Wednesday June 04, 2014 @10:33AM (#7845728)
\d finds arabic numerals? As in 0-9? Scandalous :)

http://en.wikipedia.org/wiki/Arabic_numerals

Re:Why Using .* in Regular Expressions Is Almost Never What ... by extra88 on Wednesday June 04, 2014 @11:56AM (#7846315)
Perhaps they mean Eastern Arabic numerals. http://en.wikipedia.org/wiki/Eastern_Arabic_numerals
Re:Why Using .* in Regular Expressions Is Almost Never What ... by acdha on Wednesday June 04, 2014 @02:51PM (#7847388)
Indeed - those are in use by millions of people. I wonder if any regexp implementation has started matching all of the other number symbols in Unicode:

http://en.wikipedia.org/wiki/Numerals_in_Unicode

Re:Why Using .* in Regular Expressions Is Almost Never What ... by greglindahl on Wednesday June 04, 2014 @03:52PM (#7847749)
Perl does, by default.

There's a modifier if you want to only match ASCII digits.