A regex to validate all of that can become pretty involved if you require validation of TLD's, IP addresses, of RFC standards and such. The following will only really attempt to prevent invalid characters in the domain/ip and ensure a valid port if provided:
| boolfoundMatch=Regex.IsMatch(SubjectString,@"(?:https?|ftp)://[-a-zA-Z0-9.]+(:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9][0-9]|6[0-4][0-9][0-9][0-9]|\d{2,4}|[1-9]))?"); |