3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $searchTerm = "ü"; $replaceTerm = "%FC"; $test=array("${searchTerm}/${searchTerm}_.${searchTerm}", "xay${searchTerm}", "asdasd/${searchTerm}.mp3", "${searchTerm}.", "blahahbasd${searchTerm}", "1234${searchTerm}1234"); foreach ($test as $t) echo "$t => " . preg_replace("/". preg_quote($searchTerm) . "([^_.]|$)/x", preg_quote($replaceTerm) . "\${1}", $t) . "\n";
based on FNa4U
Output for 4.3.0 - 7.1.0
ü/ü_.ü => %FC/ü_.%FC xayü => xay%FC asdasd/ü.mp3 => asdasd/ü.mp3 ü. => ü. blahahbasdü => blahahbasd%FC 1234ü1234 => 1234%FC1234