private static IEnumerable<Uri> GetEnumerator(Regex regExpr, string baseUrl, string html)
{
for (Match m = regExpr.Match(html); m.Success; m = m.NextMatch())
{
string href = m.Groups[1].ToString();
// filter non-real relation urls:
if (String.IsNullOrEmpty(href) ||
href.StartsWith("#") ||
href.StartsWith("mailto:") ||
href.StartsWith("javascript:"))
{
continue;
}
href = System.Web.HttpUtility.HtmlDecode(href);
Uri uri = null;
try
{
uri = ConvertToAbsoluteUrl(href, baseUrl);
}
catch (Exception)
{
}
if (uri != null)
{
yield return uri;
}
}
}