I am looking for a regex that validates simple website addresses, i.e.
- http://www.stackoverflow.com
- http://www.stackoverflow.com
- stackoverflow.com
- stack-overflow.co.it
I need it for contact details, ‘Website’ field, then when user click it opens IE, it doesn’t have to be strict, I just don’t want the user to enter ‘I love milk’ or ‘google’ etc.
I thought instead shrinking my mind writing my own struggling to find exception, why won’t I learn from the community experience, anyone who has a good regex or a link please post.
Thanks a lot.
From RFC 3986, Uniform Resource Identifiers (URI): Generic Syntax, appendix B (p. 50):
If the URI matches this regular expression, it’s well formed. The match groups give you the various pieces, which are: