0

i've got problems with regex, please help.

My regex code for searching table -

/<table class="curr.*?">.*?<\/table>/s

How can i search TD in that table?

  • 2
    [Don't use regexes for parsing HTML](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454) – John Conde Jun 30 '14 at 15:06
  • Then what u recommend for parsing html? – Cryptonomicon Jun 30 '14 at 15:09
  • 2
    It depends on your exact use case, whether the HTML is user-provided, etc. but definitely use a library rather than trying to solve the problem yourself. http://simplehtmldom.sourceforge.net/ is one possibility. – nullability Jun 30 '14 at 15:42

1 Answers1

0

As someone before said:

When you decide to use regular expressions to solve a problem, you end up having two problems :-)

Tidy + xPath will be my choice to do the job.

Predte4a
  • 906
  • 7
  • 6