0

I have an html page and I want to get the contents in a table. the table starts with grid tag and ends with grid tag,

My function is this:

preg_match_all("/<grid>.*<\/grid>/",$page, $matches,PREG_OFFSET_CAPTURE);

I get a null array.

airnet
  • 2,565
  • 5
  • 31
  • 35
  • 1
    Don't use Regexes to parse HTML. See [Best methods to parse HTML](http://stackoverflow.com/questions/3577641/best-methods-to-parse-html) – Pekka May 07 '11 at 09:02

1 Answers1

2

Don't use a regex, use something like QueryPath - I've used it dozens of times with great success. It works like jQuery, for PHP.

David Fells
  • 6,678
  • 1
  • 22
  • 34