I'm very new to PHP writing and regular expressions. I need to write a Regex pattern that will allow me to "grab" the headlines in the following html tags:
<title>My news</title>
<h1>News</h1>
<h2 class=\"yiv1801001177first\">This is my first headline</h2>
<p>This is a summary of a fascinating article.</p>
<h2>This is another headline</h2>
<p>This is a summary of a fascinating article.</p>
<h2>This is the third headline</h2>
<p>This is a summary of a fascinating article.</p>
<h2>This is the last headline</h2>
<p>This is a summary of a fascinating article.</p>
So I need a pattern to match all the <h2> tags. This is my first attempt at writing a pattern, and I'm seriously struggling...
/(<h+[2])>(.*?)\<\/h2>/ is what I've attempted. Help is much appreciated!