Validate url in forms using regex

  • 1 December 2017
  • 2 replies
  • 63 views

Badge +6

Hello,

 

I'm trying to validate that a user enters a URL in a text field.  I am trying to use regex validation with the following string.

 

^(http://www.|https://www.|http://|https://)?[a-z0-9]+([-.]{1}[a-z0-9]+)*.[a-z]{2,5}(:[0-9]{1,5})?(/.*)?$

 

It works on a regex tester but not on the form.  Is there something I need to do to use it on the form, or is the pattern bumpkis?

 

Thanks for your help!

 

 

 


2 replies

Userlevel 2
Badge +5

I copied the string you provided and had no issues with it in either Standard or Responsive forms so I am unable to replicate the issue.

Badge +6

quantum fart.  Went back in and added the exact same thing and it worked.

Reply