-1

I have the following problem! I want to get the shipping data from a website. They have the following structure:

enter image description here

The problem here is that there are multiple divs and in the divs there are more divs and tables. Due to the fact i am a total noob with regular expressions, i wanted to know if there is any easier solution for grabbing the data.

Crusader633
  • 595
  • 1
  • 4
  • 17

1 Answers1

4

I recommend walking the DOM using a framework like HTML Agility Pack rather than using regular expressions. Read here for more information: http://html-agility-pack.net

More specifically, when using HTML Agility Pack, as an alternative to manual DOM-traversal, you can use XPaths to define the elements you want to get the data from. You can write pretty resiliant XPaths that will identify the correct elements even when they're moved-around or formatted differently (e.g. attributes in a different order). Think of XPaths as being like CSS selectors but more powerful and with a steeper learning-curve.

As for regex, you have been warned.

wp78de
  • 18,207
  • 7
  • 43
  • 71
Dai
  • 141,631
  • 28
  • 261
  • 374