3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = <<<TEXT This is [my_name] and another being <my_name> but this isn't <my_name] because the braces don't match! TEXT; $replacement = 'BOB'; echo preg_replace( '/\[\w+]|<\w+>/', $replacement, $text );
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
This is BOB and another being BOB but this isn't <my_name] because the braces don't match!

preferences:
56.49 ms | 989 KiB | 4 Q