Hi,
I have the following html code and need to display all contents within the <h4> tags, except the one containing "Footer". I am writing a parser script in php to transform an old to a new html layout.
The old layout is basically like this:
<h4>Backgroun d</h4>
<h4>Advice</h4>
<h4>Footer</h4>
<h4>Support</h4>
And my regex looks like this:
$regex_newsecti ons = "/<h4>(.*?)(?=< \/h4>)/m";
I need the brackets surrounding .*? because I will use the contents later on in the preg_match_all function.
I have tried using a negative lookahead but none of the following work:
$regex_newsecti ons = "/<h4>(.*?)(?!Foo ter)(?=<\/h5>)/m";
$regex_newsecti ons = "/<h4>((?!Footer) .*?)(?=<\/h5>)/m";
$regex_newsecti ons = "/<h4>((?!Footer) *?)(?=<\/h5>)/m";
Does anyone have any ideas? Cheers.
I have the following html code and need to display all contents within the <h4> tags, except the one containing "Footer". I am writing a parser script in php to transform an old to a new html layout.
The old layout is basically like this:
<h4>Backgroun d</h4>
<h4>Advice</h4>
<h4>Footer</h4>
<h4>Support</h4>
And my regex looks like this:
$regex_newsecti ons = "/<h4>(.*?)(?=< \/h4>)/m";
I need the brackets surrounding .*? because I will use the contents later on in the preg_match_all function.
I have tried using a negative lookahead but none of the following work:
$regex_newsecti ons = "/<h4>(.*?)(?!Foo ter)(?=<\/h5>)/m";
$regex_newsecti ons = "/<h4>((?!Footer) .*?)(?=<\/h5>)/m";
$regex_newsecti ons = "/<h4>((?!Footer) *?)(?=<\/h5>)/m";
Does anyone have any ideas? Cheers.
Comment