#1 Parser Number Array Error

open
nobody
None
5
2009-05-19
2009-05-19
Anonymous
No

when parse text like {"testnumarray":[0,1,2]};
It causes number parse error.
The reason is in definition of "_regexNumber", the regex should be:

@"(?<minus>[-])?(?<int>(0)|([1-9])[0-9]*)(?<frac>\.[0-9]+)?(?<exp>(e|E)([-]|[+])[0-9]+)?"

The original source is missing "\" before ".", "." without escape is match any character include ",".

report by: mrxgx@msn.com

Discussion

  • the sign in the exponential part can be ommitted according to json.org.
    So 1e10 is allowed. I doubt if the regex suggestion will handle that properly.
    Guess you need an extra ? after ([-]|[+])