Any ideas how I can use a single regular expression to validate a single url and also match urls in a text block?
var x = "http://myurl.com";
var t = "http://myurl.com ref";
var y = "some text that contains a url http://myurl.com some where";
var expression = "\b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|]";
Regex.IsMatch(x, expression, RegexOptions.IgnoreCase); // returns true;
Regex.IsMatch(t, expression, RegexOptions.IgnoreCase); // returns false;
Regex.Matches(y, expression, RegexOptions.IgnoreCase); // returns http://myurl.com;