Sample Strings:
"><td>RAT</td><td>YDS</td><td>TD</td><
"><td>74.1</td><td>1,170</td><td>6</td><
"RAT" "YDS" "TD"
"74.1" "1,170" "6"
Thanks
Something like this would do it:
string value = "><td>74.1</td><td>1,170</td><td>6</td><";
Match m = Regex.Match(value, "<td>([^<]+)</td>");
while (m.Success)
{
Debug.WriteLine(m.Groups[1]);
m = m.NextMatch();
}
That said, if you have more complex HTML or "from the wild" HTML,
you'll be in a world of pain trying to use a Regexp parser. It's much
better to use a HTML parser like the Html Agility Pack:
http://www.codeplex.com/htmlagilitypack
> What would be the Regex to capture the following fields from the sample
> strings?
In my opinion: Nothing. I'm on the "Don't do it" side of the "Should I use
RegEx to parse HTML?" holy war. I agree with Random, use an HTML parsing
library, and I second the suggestion of the HTML Agility Pack. I've used it
and it rocks.
Thanks for the input and Random, thanks for the solution. (It worked).
Looking at Agility Pack, hummmmm, getting up to speed with Regex is a
steep climb. At first glance Agility Pack looks like Mt. Everest. I will
re-visit it and give it another chance.
Thanks again.
Trey
"Jeff Johnson" <i....@enough.spam> wrote in message
news:enAejulf...@TK2MSFTNGP05.phx.gbl...
> Looking at Agility Pack, hummmmm, getting up to speed with Regex is a
> steep climb. At first glance Agility Pack looks like Mt. Everest. I
> will re-visit it and give it another chance.
There will defnitely be more code involved with the HTML Agility Pack; no
doubt about it. But it will be readable code as opposed to the nightmare
(but arguably compact!) RegEx you'd have to develop to deal with "ugly"
HTML.