When reading pattern from HTML it is used directly as a regular expression, which is not correct. The spec says
The compiled pattern regular expression, when matched against a string, must have its start anchored to the start of the string and its end anchored to the end of the string.
This implies that the regular expression language used for this attribute is the same as that used in JavaScript, except that the pattern attribute is matched against the entire value, not just any subset (somewhat as if it implied a ^(?: at the start of the pattern and a )$ at the end).
That means native validation using pattern="\d{5}" only accepts exactly five numbers. But knockout validation will use this as a regular expression, which will accept anything that contains five numbers aynwhere. E.g. foo12345bar.
When reading
patternfrom HTML it is used directly as a regular expression, which is not correct. The spec saysThat means native validation using
pattern="\d{5}"only accepts exactly five numbers. But knockout validation will use this as a regular expression, which will accept anything that contains five numbers aynwhere. E.g.foo12345bar.