How do I match between two closing tags with regex in php?

damoneel

New Member
I have a piece of HTML (NOT a full HTML document) that has a few instances of the following:\[code\] </div> some text is here </h3>\[/code\]I'd like to match 'some text is here' only but am having trouble understanding multiple lines, line breaks and spaces with php regex. What I got is:\[code\] preg_match('/<\/div>[\s\r\n\t]*(.*)[\s\n\r\t]*<\/h3>/', $string, $matches);\[/code\]But that doesn't seem to work. I tried using DOMDocument() as well but it's throwing all sorts of errors, probably because this is not a full HTML document.Any ideas??
 
Top