1

Been struggling with this for awhile. I can't seem to figure out how to get a regex request to only return the value attribute of a particular html tag. Any help is greatly appreciated.

FoxyGT
  • 69
  • 3
  • 8

2 Answers2

3

Are you trying to parse HTML with Regex? Don't or you will continue to struggle. Use SgmlReader or HTML Agility Pack for this purpose.

Community
  • 1
  • 1
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
0

RegEx is not a good solution for parsing unstructured (or unknown) HTML.

See this SO post for compelling reasons why this is the case.

I suggest using a parser such as the HTML Agility Pack and querying the parsed document.

Community
  • 1
  • 1
Oded
  • 489,969
  • 99
  • 883
  • 1,009