1

I want to check some domains with regular expression (regex). My old code was:

/^([a-z0-9]+([-a-z0-9]*[a-z0-9]+)?.){0,}([a-z0-9]+([-a-z0-9]*[a-z0-9]+)?){1,63}(.[a-z0-9]{2,7})+$/i  

It works but this code doesn't validate IDNs (internationalized domain names) such as öü.com or öü.öü and doesn't check "www", "http://" terms.

My domain format is:

  • example.com

Besides, I don't want:

Important note: user can add the domains;

  • with 2 extension like example.co.uk
user3620931
  • 131
  • 9
  • Use a function that parses a URL into its constituent parts, e.g. `parse_url()`. Then check whatever you want to check, which I'm not clear what exactly that is. – deceze May 15 '14 at 12:47
  • @deceze Thank you very much for your answer. But your solution will be hard for me. I hope to find true regex codes for this check. Best regards, – user3620931 May 15 '14 at 12:51

0 Answers0