Been reading some regex tutorials lately and figured it’s time to start putting this stuff into practice… Unfortunately that isn’t working so well at the moment haha
I’m trying to match a paragraph in a HTML document, so for example:
<p style = "blah">This is a test paragraph <b>OK</b></p>
Run into a problem with that regex when reading the entire html document because it will match from the first opening p tag to the final closing p tag. For example:
<?php
$strPara = '<p style = "blah">This is a test paragraph <b>OK</b></p><p style = "blah">This is a test paragraph <b>OK2</b></p><p style = "blah">This is a test paragraph <b>OK4</b></p>';
printf('<p>%s</p>',preg_replace('/^<p.*?>(.*?)<\\/p>$/','$1',$strPara));
?>