what to expect when dating a frenchman - Regular expression for validating url
The problem with this is that the default Internet URL This offers a wider support for URL’s, but there is a small gotcha that you need to be aware of. If the user adds a url without http or https then an anchor with that url applied will break because it will be calling an external url, which requires the protocol; otherwise it is handled as a relative link by your browser. Of course, I recommend you always extract your common code into reusable methods, but that’s another discussion!
The easiest and safest way to check whether an email address is well-formed is to use PHP's filter_var() function.
On a last note, the class also contains a scheme (aka protocol) validation regular expression.
I made this repository specifically for Mathias Bynens' little “in search of the perfect URL validation regex” challenge and if I may spoiler you from the beginning, mine is not perfect.