Reputation: 3
I have HTML code:
<tr class="odd"><td style="display:none">id>26847504,level>0,key_left>0,key_right>0,name>Random.Stuff345345,type>
I want to get those:
I already tried that:
<tr class=\".+\"><td style=\"display:none\">id>([0-9]+),level>0,key_left>0,key_right\>0,name>([^,]+),type>
But it doesn't work.
Upvotes: 0
Views: 105
Reputation: 43663
It is very bad idea to parse HTML with regex, but if you want to...
using System;
using System.Text.RegularExpressions;
class Program
{
static void Main()
{
string input = "...";
Match match = Regex.Match(input, @"id>([^,]*).*?name>([^,]*)");
if (match.Success)
{
Console.WriteLine(match.Groups[1].Value);
Console.WriteLine(match.Groups[2].Value);
}
}
}
Test the code here.
Upvotes: 2