Firefox error with link validation regex patterns [#3365954]

This is easily reproducible:
In a field where the patterns in \Drupal\clientside_validation\Plugin\CvValidator\UrlInternalExternal::addValidation are used to evaluate a URL, a jquery error in firefox results: “Unable to check |\/.*|\?.*|#.*|[hH][tT][Tt][pP][sS]?://.+|.*\(\d+\)’> because the pattern is not a valid regexp: invalid identity escape in regular expression” – visible in the console of devtools.

If you remove the backslashes before the angle brackets in \ within the pattern in the method, the error goes away. This change does not cause errors to be reported in Chrome. Note that I am not able to check to see if this impacts the effectiveness of the module.

There are other cases reported of this kind of thing with firefox’s regex, e.g. itecnote.com/tecnote/html-firefox-error-unable-to-check-input-be…

Read more here: Source link