3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s = 'width=222<iframe >width=222<embed boo width=222>fdgwidth=700dfg</embed>sfsdfsdf</iframe>'; $matches = array(); var_dump( preg_replace('~(.*<[^>]+\swidth=["\']?)(\d+)(["\']?[^>]*>.*)~', '${1}---${3}', $s) );

preferences:
37.98 ms | 402 KiB | 5 Q