Last Updated on :
Friday 28 January, 2022
Validate URL input in WIX using regex/pattern
In this tutorial we will learn how to add the pattern validation to the URL user input field. This will be useful for member areas, where user has to share his social media or professional network link and admin wants to make the exact site link required.
The task will be to allow user to put only https://tanacadmy.com links
Lets begin...
As we all know, Wix gives an opportunity to choose the type of input. We will use URL type in that tutorial. The same(or similar) regex can be used with other input types.
Let’s addpattern validation in the Input Settings. I use that one: http[s]{0,1}://[w]{0,3}[.]{0,1}tanacadmy.com/.{1,64}
What we have here? [s]{0,1} —’ s’ symbol can be used once or not used at all. You can use [s]? too. *this was done to handle both http:// and https://
[w]{0,3} — w symbol can be used zero or three times [.]{0,1} — ‘.’ symbol can be used once or not used at all * those was done to handle www and non-www versions
.{1,64} — at the end we will have from 1 to 64 any symbols. *this was done to avoid using just https://www.tanacadmy.com/ URL
Thanks for reading! Let us know if you have any questions ♥
We have an awesome team who will help you with any task in Wix.
Have any questions? Ask in Responses or via email: mail@tanishqsundhan.com
Request new tutorials in Responses!