Regular expression for checking website url

后端 未结 6 614
轻奢々
轻奢々 2020-12-03 14:35

I need to check the web address, using regular expression.

if user type url as

  1. www.test.com
  2. http://www.test.com
  3. https://www.test.com
6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-03 15:29

    Pattern

    (https?:\/\/)?([\w\d]+\.)?[\w\d]+\.\w+\/?.+

    This will work for matching:

    www.demo.com

    http://foo.co.uk/

提交回复
热议问题