Simple for you guys hard for me though!!
Ima complete idiot when it comes to regex, i cant for the life of me work out how this works. I've read many books about it and tutorials and i still dont understand it.
So first: im trying to strip text from a string and store the result into an array
Example:
$string = cxvcxvxcaaabcxb<h2>the is the header</h2>jg<h2>the is the header</h2>jhgt<h2>the is the header</h2>he
I want to store the h2 tags and information contained in the tags into an array. Like this
$retrieved = array('<h2>the is the header</h2>','<h2>the is the header</h2>','<h2>the is the header</h2>')
Now i've managed to put to gether some regex which sort of works, it matches the patrn and returns a match
$match = preg_split("/<h[1-9]{1}>.*\s<\\/h[1-9]{1}>/", $string);
but it doesnt work with preg_splt 🙁
Where am i going wrong?