It's easy - you don't need regular expressions at all! Just construct a URI with a string seed value, and if it doesn't throw an exception, you're golden! That doesn't tell you whether the resource actually exists on the server, only whether the string is a valid URL.
Code:
try {
Uri urlTest = new Uri("http://www.example.com");
// Do your thing!
} catch(Exception ex) {
System.Diagnostics.Debug.WriteLine("Not a valid url!");
}
|