0

What is the URL pattern that is being used with the HTML5 element input type="url". I tried some regex from various forums but felt HTML5 url element is having a different pattern of regex. Can someone crack the regex for it? Thanks.

3
  • 1
    I'm guessing it's an RFC 3987 compliant regular expression, something like this Commented Oct 9, 2015 at 7:04
  • Can you suggest me an equivalent regex for input type="url" ? Thanks Commented Oct 12, 2015 at 8:04
  • Possible duplicate of What regular expression does a browsers use for HTML5 input type=url? Commented Aug 28, 2017 at 3:04

1 Answer 1

0

I somehow managed to get an equivalent regex for type="url" element.

/^(ftp|http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]+)|((25[0-5]|2[0-4][0-9]|[1][0-9][0-9]|[1-9][0-9]|[0-9]?)(\.(25[0-5]|2[0-4][0-9]|[1][0-9][0-9]|[1-9][0-9]|[0-9]?)){3}(:?[0-9]*)))?(\/.*)?$/ix
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.