I try to find links in the text entered by the user and automatically convert them to a link.
I use the current Regex as the following, which is useful for finding hyperlinks from text.
Regex regexResolveUrl = new Regex("((http://|www\\.)([A-Z0-9.-:]{1,})\\.[0-9A-Z?;~&#=\\-_\\./]{2,})", RegexOptions.Compiled | RegexOptions.IgnoreCase);
It works well for almost all links while I stumbled, but this is a problem when I want to detect links with hypen.
i.e. www.abc-xyz.com will not work using regex, can anyone help me with this?
semmy source
share