Php regex to extract data from HTML table?

Tim's regex probably works, but you may want to consider using the DOM functionality of PHP instead of regex, as it may be more reliable in dealing with minor changes in the markup.

Tim's regex probably works, but you may want to consider using the DOM functionality of PHP instead of regex, as it may be more reliable in dealing with minor changes in the markup. See the loadHTML method.

Quote65:You wouldn't steal a helmet of a policeman Note : you should add some security checks (like preg_match_all must return true, count must be at least 1, ...) As a side note : using regex to parse HTML is generally not a really good idea ; if you can use a real parser, it should be way safer...

As usual, extracting text from HTML and other non-regular languages should be done with a parser - regexes can cause problems here. But if you're certain of your data's structure, you could use %((?s). *?)\s*((?s).

*? )% to find the two pieces of text. \1:\2 would then be the replacement.

If the text cannot span more than one line, you'd be safer dropping the (?s) bits...

Don't use regex, use a HTML parser. Such as the PHP Simple HTML DOM Parser.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions