You've re-invented Perl's /x for Javascript, congrats!
Some people like them, others feel that they don't really solve the fundamental problem of regexes being unreadable. I can say that I've seen examples of /x use where those in-lined comments helped greatly.
Whether such a complex regex should really have been expressed with parser combinators instead, which allows for composing and naming sub-parts of an expression as logical units, one could argue.
You've re-invented Perl's
/x
for Javascript, congrats!Some people like them, others feel that they don't really solve the fundamental problem of regexes being unreadable. I can say that I've seen examples of
/x
use where those in-lined comments helped greatly.Whether such a complex regex should really have been expressed with parser combinators instead, which allows for composing and naming sub-parts of an expression as logical units, one could argue.
Thank you for all the information. I will dig in and explore both the Perl tools you mentioned and the parser combinators.
Exciting stuff!