hmm... this works for me:
<?php
$str = '%%BeginResource: font ABCDEF+RodinCID-AB
..crap load of data..
%%EndResource
.. misc crap ..
%%BeginResource: font GHIJKL+RodinCID-CD
..crap load of data..
%%EndResource
.. misc crap ..
%%BeginResource: font MNOPQR+RodinCID-EF
..crap load of data..
%%EndResource';
$pattern = '/%%BeginResource:.*?%%EndResource/ms';
if (preg_match_all($pattern, $str, $matches))
{
foreach ($matches[0] as $match)
{
echo '[' . $match . ']<br />';
}
}
else
{
echo 'No matches.';
}
?>
Out of curiosity, did you happen to change '.*?' to '.*'? I notice that you were doing greedy matching in your example, so perhaps when modifying my example, you changed it to greedy too and thus it did not work.