3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = ' <section> <paragraph>new article test</paragraph> <paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/"> <literal>$nbsp: &amp;nbsp; $amp;nbsp: &amp;amp;nbsp: $amp;$nbsp: &amp;amp;&amp;nbsp; </literal> </paragraph> </section>'; $pattern = '(<paragraph[^>]*\>)((?<pre>.*)(?<nb>&amp;nbsp;)(?<post>.*))(<\/paragraph>)'; $newXml = preg_replace( $pattern, '-', $xml ); var_dump( $newXml );
Output for 5.6.0 - 7.2.6
Warning: preg_replace(): Unknown modifier '(' in /in/4OWhi on line 15 NULL