3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "This is <a href=\"http://foo.com\">This is #foo</a>.\nSimple #html-stuff text <a href=\"http://foobar.com#baz\">#simple</a>. \n<span class=\"simple\">simple #simple text text</span>'; $str = preg_replace('/(?!<a[^<>]*>[^#]+)#(\b[-_\w]+\b)(?![^<]*<\/a>)/', '<a href="/tags/$1">#$1</a>', $str); echo $str;
Output for 5.4.0 - 5.4.27
Parse error: syntax error, unexpected '1' (T_LNUMBER), expecting variable (T_VARIABLE) or '$' in /in/stXUf on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /in/stXUf on line 5
Process exited with code 255.

preferences:
191.64 ms | 1395 KiB | 64 Q