Mascara Try it Download Buy About Documentation Blog

Multiline Regular Expressions

With the x flag, a regular expression can span multiple lines and include comments. Example:
var ptn = /
   [a-zA-Z]  # letter
   \d{2,3}   # 2-3 digits
/x;
ptn.test("x23");

Comments start with the #-sign and extends to the end of the line. All whitespace is insignificant (unless escaped with a backslash).