php regex to extract data from HTML table

前端 未结 5 2095
春和景丽
春和景丽 2020-12-30 18:07

I\'m trying to make a regex for taking some data out of a table.

the code i\'ve got now is:

\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...

提交回复
热议问题
quote1
5条回答
  •  无人及你
    2020-12-30 18:51

    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).*?)