Regex for multi-line HTML comments (preg_match_all)

Posted by Ben on Stack Overflow See other posts from Stack Overflow or by Ben
Published on 2010-04-06T12:19:09Z Indexed on 2010/04/06 12:23 UTC
Read the original article Hit count: 337

Filed under:
|
|
|

I have an html document with multiple commented-out PHP arrays, e.g.:

<!-- Array
(
[key] => 0
)
-->

Using PHP, I need to somehow parse the HTML for only these comments (there are other comments that will need to be ignored) and extract the contents. I've been trying to use preg_match_all but my regex skills aren't up to much. Could anyone point me in the right direction?

Any help is much appreciated!

© Stack Overflow or respective owner

Related posts about php

Related posts about regex