Pro Forms validation

I have a form with a text field. I don’t want people to enter any kind of link. How can I make sure of that?

Thanks
Dirk

Hi Dirk,

you can do this with a custom validation rule on the text field:

  1. Select the text field and open the Validation group.
  2. Add a new item under Validation Rules and set Validation Type to “Custom (Regex)”.
  3. Paste this into the Regex field:

^(?![\s\S](https?:|www.))[\s\S]$

  1. Optionally enter a Validation Message, for example “Please don’t enter links.”

The field is valid only if the regex matches, and this one only matches text that contains neither “http:”, “https:” nor “www.”. An empty field still passes, so you can combine it with “Required” if needed. The rule is checked in the browser and again on the server when the form is submitted.

Two things to keep in mind: the check is case-sensitive, so “HTTPS:” or “WWW.” in capitals would pass. And a bare domain like example.com isn’t caught, because that is hard to tell apart from normal text such as the end of a sentence. If you want to cover capitals too, use this variant instead:

^(?![\s\S]([Hh][Tt][Tt][Pp][Ss]?:|[Ww][Ww][Ww].))[\s\S]$

Best,
Daniele