Possible Duplicate:
regex for URL including query string
I have a text or message.
Hey! try this http://www.test.com/test.aspx?id=53
Our requirement is to get link from a text.We are using following code
List<string> list = new List<string>();
Regex urlRx = new
Regex(@"(?<url>(http:|https:[/][/]|www.)([a-z]|[A-Z]|[0-9]|[/.]|[~])*)",
RegexOptions.IgnoreCase);
MatchCollection matches = urlRx.Matches(message);
foreach (Match match in matches)
{
list.Add(match.Value);
}
return list;
It gives url but not the complete one.Output of the code is
But we need complete url like
Please suggest how to resolve that issue.Thanks in advance.