Guarded new RegExp(...): validates pattern with
assertGuardedRegexPattern (throwing UnsafeRegexPatternError
on rejection) and only then compiles it with the JS RegExp
constructor, which itself may throw SyntaxError for a malformed
pattern the guard did not reject.
Guarded
new RegExp(...): validatespatternwith assertGuardedRegexPattern (throwing UnsafeRegexPatternError on rejection) and only then compiles it with the JSRegExpconstructor, which itself may throwSyntaxErrorfor a malformed pattern the guard did not reject.