I'm trying to use a regex to find a string. For example, my text is :
$text="<h2>Introduction of Abdominal aortic aneurysm</h2>
<p>In this section, we will learn about symptom, causes, and treatment of
AAA</p>
<h2>This is Treatment for a burst AAA</h2><p>.......<p>
<h2>.........</h2>"
I want to find :
$temp="<h2>This is Treatment for a burst AAA</h2>
<p>.......<p>"
I try this pattern :
Preg_match("/<h2(.*?)Treatment(.*?)<h2>/i",$text,$matches);
if i echo $matches[1] it will return:
"Introduction of Abdominal aortic aneurysm</h2>
<p> In this section, we will learn about symptom, causes, and "
and if i echo $matches[2] it will return:
" of AAA<p>"
how to get $matches that match to this sentence :
"<h2>This is Treatment for a burst AAA</h2>"
Actually i want to make a pattern that match a text inside a tag not a
tag.
tag will return a bold text
– Arifin _ Jul 20 '18 at 03:08