How do you understand regular expressions that are written in one line?

This is a neat well documented regular expression, easy to understand, maintain and modify.

    text = text.replace(/
    (                               // Wrap whole match in $1
        (
            ^[ \t]*>[ \t]?          // '>' at the start of a line
            .+\n                    // rest of the first line
            (.+\n)*                 // subsequent consecutive lines
            \n*                     // blanks
        )+
    )
    /gm,

But how do you go about working with these?

text = text.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,

Is there a beautifier of some sort that makes sense of it and describes its functionality?

6
задан Robinicks 29 August 2010 в 20:20
поделиться