3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'ﺫﺫ'; var_dump(preg_replace('#(?:^[^\pL]+|[^\pL]+$)#u', '', $string));

preferences:
30.12 ms | 405 KiB | 5 Q