I’m trying to make sense of the application of regular expression validation.
In my particular case, I want to block any use of “href” from a textarea field. The existence of a regular expression pattern field would suggest that I supply something typical like /^((?!href).)*$/
, but that winds up having the unexpected effect of rejecting pretty much any text.
I looked at where the pattern is applied, and found this at line 296 of TextBase.php of Webform 8.5.23:
$pattern = '{^(?:' . $pcre_pattern . ')$}u';
…which means that the preg_match pattern is being converted to {^(?:/^((?!href).)*$/$}u
, which obviously isn’t very helpful.
So, what are appropriate pattern formats for entering into the regular expression field of a validation? And as an aside, why does the pattern concantenator shown lack /
delimiters?