-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Description
Edit: SEE NEXT COMMENT IN THIS ISSUE FOR PROPER SOLUTION.
This library is fine for basic parsing, but it's not a proper parser. It's a basic regex.
regex = re.compile(r"(\".*?\"|\'.*?\')|(/\*.*?\*/|//[^\r\n]*$)", re.MULTILINE | re.DOTALL)
newline_replace_regex = re.compile("\n{2,}", re.MULTILINE)This basic regex means that it fails on things like this:
{
/* Commented out
"data": "foo */ bar",
*/
}Because it doesn't understand things like */ inside of data fields, or escaped letters like \*/.
So don't rely on this package for critical production use. But it's fine for basic little scripts.
Edit: In fact it doesn't even handle escaped quotes inside strings, such as "hello \"user\"". So use this library at your own risk.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels