Regular expressions are often hard to read.
After reading an article about verbose regular expressions in Python, and how one could do something like this in ECMAScript, I realised that there is one really simple way how this could be done:
Simply concatenate multiple chunks, which are separated by whitespace, back into one. So
/expr1/ /expre2/ is read and executed as
This way it becomes much more readable and we can also easily add comments:
new RegExp( /expr1/ // comments on expr1 /expr2/ // comments on expr2 , 'i' )
AFAIK this shouldn't be to hard to do.