I have some texts that may contain links like this:
<a rel="nofollow" target="_blank" href="http://loremipsum.net/">http://loremipsum.net/</a>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, <a rel="nofollow" target="_blank" href="http://loremipsum.net/">http://loremipsum.net/</a> sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
I want to find links (a
tags) inside this text, what is the regex pattern for that?
This pattern doesn't work:
const string UrlPattern = @"(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?";
var urlMatches = Regex.Matches(text, UrlPattern);
thanks