onebeyond / react-form-builder

React Form Builder
http://guidesmiths-react-form-builder.s3-website.eu-central-1.amazonaws.com/
MIT License
31 stars 11 forks source link

Email input validator pattern #22

Open FranciscoValdesoiro opened 3 years ago

FranciscoValdesoiro commented 3 years ago

Is your feature request related to a problem? Please describe. We need to apply pattern validators

kuhlaid commented 2 years ago

The current email pattern /^(([^<>()[]\\\\.,;:s@\\\"]+(.[^<>()[]\\\\.,;:s@\\\"]+)*)|(\\\".+\\\"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/ in the example does not work for email addresses. Try entering a valid email at https://regex101.com/ using this pattern and it does not match. Try regex pattern /\S+@\S+\.\S+/ instead. In the JSON form template it would need to be escaped like the following.

        "registerConfig": {
          "required": true,
          "pattern": "/\\S+@\\S+\\.\\S+/"
        }

The regex patterns within the form template do not seem to be working currently. (I tried cloning the repository and setting up the development server locally but kept running into errors trying to get the examples to run, so I'm not sure what is going on with that.)