I know this has been asked in some capacity - but I was not able to see working example of the solution yet. I know that there is the Html Agility Pack to parse HTML strings, but I do not wish to download/install it. I get the contents of a webpage using
string html = client.DownloadString("http://yoursite.com/page.html");
I have a tags which have a class with them, but some of those tags also have their own ID, or style, etc for example:
<td>I Dont want this</td>
<td class="myClass">I want this</td>
<td class="myClass" id="myID">I want this</td>
<td style="border-top-width: 0px; class="myClass">I want this</td>
I tried
<td>(.*?)</td>
But it returns the tags without any class, id, etc.
I tried
<td class="myClass"[^>]*>(.*?)</td>
But it returns only the second and third <td>
values but not the fourth. How can I add a wildcard to return any <td>
with myClass
but ignores anything that comes before or after like id
or style
?