Regular expression for URL

You don’t need a regex for URLs, use System.Uri class for this. E.g. by using Uri.IsWellFormedUriString method for this:

bool isUri = Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute);

Leave a Comment