0

I need a Regex for all URLs:

I'm using:

(((http)s?(:\/\/)(w{3})?)|(w{3})| (http)s?)((.))[A-Z a-z 0-9]*.([A-Z a-z]){0,3}

The result should be:

www.demo.com (OK)
http://foo.co.uk/(Not OK bad .uk)
http://foo.com/foo.html?q=bar (OK)
https://www.lol.lol  (OK)
http://www.foo.foo.fr( Not OK bad .fr)
arco444
  • 22,002
  • 12
  • 63
  • 67
  • 2
    Why are the `Not OK` ones not ok? Look perfectly valid to me... – arco444 Jan 29 '15 at 15:47
  • 1
    You're obviously using a different definition for "all url" than most people would use. Are you wanting to exclude everything bar `.com` domains? Also, URLs are used for more things than just HTTP. Are you wanting to just accept http(s) URLs? – Damien_The_Unbeliever Jan 29 '15 at 15:48
  • Look into the source-code of the jQuery plguin validationEngine (https://github.com/posabsolute/jQuery-Validation-Engine) and try to look for the `url` validation, inside the file https://github.com/posabsolute/jQuery-Validation-Engine/blob/master/js/languages/jquery.validationEngine-en.js. It's on the line 128. – Ismael Miguel Jan 29 '15 at 15:49
  • thanks for http://stackoverflow.com/questions/161738/what-is-the-best-regular-expression-to-check-if-a-string-is-a-valid-url :) – Christophe Gonfrere Jan 29 '15 at 15:54

0 Answers0