I am using a regex to validate a URL in c#. Regex is:
^((((http(s)?|ftp(s)?):(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:([a-zA-Z]{1,}\.)|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$
It is working fine for the url like : http://stackoverflow.com, stackoverflow.com but I also want to validate http://localhost:1234 and localhost:1234.