Proper dotAll JS regexp usage
ECMA doesn't officially support `/s` as a re flag; Firefox apparently
does[1], but that's not portable.  Instead, use the more permissive
non-dot character class `[\s\S]` to match printable and non-printable
(whitespace) characters.
[1]:
} else if (value != "") {
switch (type) {
case "pem-x509":
- if (!value.match(/^\s*-----BEGIN CERTIFICATE-----.*-----END CERTIFICATE-----/s)) {
+ if (!value.match(/^\s*-----BEGIN CERTIFICATE-----[\s\S]+-----END CERTIFICATE-----/)) {
$form.error(field, 'invalid');
}
break;
case "pem-rsa-pk":
- if (!value.match(/^\s*-----BEGIN (RSA )?PRIVATE KEY-----.*-----END (RSA )?PRIVATE KEY-----/s)) {
+ if (!value.match(/^\s*-----BEGIN (RSA )?PRIVATE KEY-----[\s\S]+-----END (RSA )?PRIVATE KEY-----/)) {
$form.error(field, 'invalid');
}
break;
