My company is getting a few (3-5) spam emails per day through a customer contact form. The reCaptcha we are using isn't blocking them for some reason, but they are so few perhaps there is an actual human involved.
One thing they have in common is some kind of URL link in the paragraph text box meant for additional comments. There isn't any reason for actual customers to be posting URLs, so we figured we could just set the validation to exclude them and call it a day. But, I can't get it to work.
When editing the text box, I've gone to Advanced > Model > ValidatorDefinition so I can enter my custom regular expression code for disallowing anything with http/https/ftp:
^(?!((http[s]?|ftp):\/)?\/?)
But I'm having trouble determining what field to enter this in and what other fields I need to change to make sure this works properly. From this article, it seems the ExpectedFormat field should be Custom, but where does my regular expression code go? Putting it in the RegularExpression field is activating the RegularExpressionViolationMessage for any content whatsoever, not just for URLs, so I suspect my regular expressions may be wrong even if I have it in the right place.
I cannot really speak into the configuration part. The linked docs look pretty clear.
If you are in a dynamic module, this post might help:
You can find a regex field in the ModuleBuilder module -> Your module -> Your module type -> Click on the desired field for the regex validation -> select "limitation" tab (example).
Regarding the regex itself, try it like this (demo)
^((?!(?:(https?|ftp)(?::\/\/))).)*$
You might need to add a (?s)
single line flag: (?s)^((?!(?:(https?|ftp)(?::\/\/))).)*$