I'm using the regex
with preg_match_all() to catch all of the HTML code that are found within the comments
My results are as follow:
After parsing this HTML file:
What I want is:
What am I doing wrong with the regex?
---------------------------------------
Code:
/<!\-\-\s+BEGIN (.+?)\s+\-\->(.+?)!\-\-\s+END %s\s+\-\->/ims
Code:
<!-- BEGIN whatever -->random HTML code<!-- END whatever -->
My results are as follow:
Code:
Array
(
[0] => Array
(
[0] => <!-- BEGIN table -->
TABLE
<!-- BEGIN table_row -->
ROW
<!-- END table_row -->
<!-- END table -->
)
[1] => Array
(
[0] => table
)
[2] => Array
(
[0] =>
TABLE
<!-- BEGIN table_row -->
ROW
<!-- END table_row -->
)
)
After parsing this HTML file:
Code:
<html>
<head>
<title>{TITLE}</title>
</head>
<body>
<!-- BEGIN table -->
TABLE
<!-- BEGIN table_row -->
ROW
<!-- END table_row -->
<!-- END table -->
</body>
</html>
What I want is:
Code:
Array
(
[0] => Array
(
[0] => <!-- BEGIN table -->
TABLE
<!-- BEGIN table_row -->
ROW
<!-- END table_row -->
<!-- END table -->
)
[1] => Array
(
[0] => <!-- BEGIN table_row -->
ROW
<!-- END table_row -->
)
)
What am I doing wrong with the regex?
---------------------------------------