Extract multiple lines of HTML using Regular Expression in PHP

by kiawin

Extract HTML content using regular expression (regex) involving multiple line of data cannot be done without additional PRCE pattern modifier sU. The dot-asterisk (.*) alone will not allow PHP regex function to perform accordingly as the dot repesents all characters except newline. Bummer.

The correct way will be as follow:
[crayon lang=”php”]preg_match(‘/(.*)/sU’, $content, $match);[/crayon]

Solution credit to dreamluverz via Mr. G.