Affecting <input pattern> now sets u flag for regular expressions

Published: | Categories: HTML


The pattern attribute on the <input> element, introduced with HTML5, is used to check the entered value against the author-defined regular expression. Starting with Firefox 46, the new u flag, introduced with ECMAScript 2015 (ES6), is set for the expression according to the latest HTML spec, treating it as a sequence of Unicode code points. Therefore, an unnecessary or invalid escape in the pattern such as [\@\%] will raise a SyntaxError saying “invalid identity escape in regular expression” and the validation will fail.