Test for ES6 RegExp construct a new RegExp from exiting RegExp pattern and new flags On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". PASS re.test(" Abc ") is true PASS re.flags is "" PASS re.test(" ABC ") is true PASS re.flags is "i" PASS re.test(" Abc ") is true PASS re.flags is "" PASS re.exec("abcABCAbc").toString() is "abc" PASS re.exec("abcABCAbc").toString() is "ABC" PASS re.exec("abcABCAbc").toString() is "Abc" PASS re.flags is "iy" PASS re.test("abc") is false PASS new RegExp(re, "bad flags") threw exception SyntaxError: Invalid flags supplied to RegExp constructor.. PASS successfullyParsed is true TEST COMPLETE