I'm using a regex that strips the href tags out of an html doc saved to a string. The following code is how I'm using it in my C# console app.
Match m = Regex.Match(htmlSourceString, "href=[\\\"\\\'](http:\\/\\/|\\.\\/|\\/)?\\w+(\\.\\w+)*(\\/\\w+(\\.\\w+)?)*(\\/|\\?\\w*=\\w*(&\\w*=\\w*)*)?[\\\"\\\']");
if (m.Success)
{
Console.WriteLine("values = " + m);
}
However, it only returns one result, instead of a list of all the href tags on the html page. I know it works, because when I trying RegexOptions.RightToLeft
, it returns the last href tag in the string.
Is there something with my if statement that doesn't allow me to return all the results?