I use a regex that removes href tags from an html document stored in a string. The following code is how I use it in my C # console application.
Match m = Regex.Match(htmlSourceString, "href=[\\\"\\\'](http:\\/\\/|\\.\\/|\\/)?\\w+(\\.\\w+)*(\\/\\w+(\\.\\w+)?)*(\\/|\\?\\w*=\\w*(&\\w*=\\w*)*)?[\\\"\\\']");
if (m.Success)
{
Console.WriteLine("values = " + m);
}
However, it returns only one result, and not a list of all href tags on the html page. I know this works because when I try RegexOptions.RightToLeft, it returns the last href tag in the string.
Is there something with my if statement that prevents me from returning all the results?
source
share