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?