3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $regex = '#<tag foo="bar">([\w\s]+[^\s]+)\s?</tag>#'; echo preg_replace($regex, '\1', '<tag foo="bar">Jacopo Nuzzi</tag>'); echo preg_replace($regex, '\1', '<tag foo="bar">Jacopo Nuzzi </tag>'); echo preg_replace($regex, '\1', '<tag foo="bar">Jacopo </tag>'); echo preg_replace($regex, '\1', '<tag foo="bar">Jacopo</tag>');
Output for 4.3.0 - 7.2.0
Jacopo NuzziJacopo NuzziJacopoJacopo