Against a string like this:
<h3>title</h3>
<h4>title</h4>
How to match the tags correspondingly and get the text in them?
This works but it unnecessarily gets the tag name:
'@<(h[34])>(.+)</\1>@sU'
However this doesn't seem to work as I don't want to get the tag name but just want to backreference it:
'@<(?:h[34])>(.+)</\1>@sU'
I'm using PHP preg_match(). Why doesn't the 2nd approach work? Is it possible to back reference a non-capturing group?