I have a string that may contain substring:
<h1 style="margin: 0; padding: 0" class="title_big">Item title <span style="white-space: nowrap"> (5 entries)</span></h1>
or just
<h1 style="margin: 0; padding: 0" class="title_big">Item title</h1>
(with no internal SPAN
) Now I can't figure out how to compose regexp. Currently using such one:
$pat='/<h1 style="margin: 0; padding: 0" class="title_big">([^>]*)<\/h1>/si';
but of course it doesn't return match for substring with internal SPAN
If you set $pat
to this instead it should work:
$pat = '/<h1 style="margin: 0; padding: 0" class="title_big">(.*?)<\/h1>/uim';