4 ms·
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
by mhaymo 12y ago
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®ex=\d%2B&input=10%0Ax%0AX%0AVII%0AMMXIV http://regexpal.com/?flags=g®ex=\d%2B&input=10%0Ax%0AX%0A...
- mmastrac 12y agoThere's a whole lot of these numeral characters in unicode, for example: http://www.charbase.com/2169-unicode-roman-numeral-ten http://www.charbase.com/2169-unicode-roman-numeral-ten (even more in http://www.charbase.com/block/number-forms 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}.
- fennecfoxen 12y ago> /\d/.test("\u2169") false
- pyre 12y agoThere's also the character classes in Unicode: http://www.fileformat.info/info/unicode/category/index.htm http://www.fileformat.info/info/unicode/category/index.htm
- jaredmcateer 12y agoRuby also does not match roman numerals with \d http://rubular.com/r/bOCmLIfKdZ http://rubular.com/r/bOCmLIfKdZ