News for hackers. Stuff that matters.
Re:Parsing JSON with a single regex by ot on Tuesday October 22, 2013 @03:18AM (#6590250)
To whomever is thinking "but JSON is not regular!", note that that regex is not a regular expression (Perl has a very liberal definition of regexes).

Perl regexes can be recursive: the operator $^R means "match here the whole regex itself", making the matching algorithm a full recursive descent parser. I suspect that parsing speed wouldn't be too bad because JSON is LL(1), so the parser shouldn't backtrack.

I don't think that the author is suggesting to use this in any useful code, he's just showing a cool hack. It kind of resonates well with the Perl aesthetics of short, "clever" code with as little as possible dependencies (and a fascination for regexes).

Re:Parsing JSON with a single regex by fulafel on Tuesday October 22, 2013 @05:20AM (#6590610)
The original Randal Schwartz post (http://www.perlmonks.org/?node_id=995856) says it was infact code for a customer app.