- preg_replace_callback: documentation ( source)
- preg_replace: documentation ( source)
<?php
$this_entered_uri = "some/ads123/test1";
echo preg_replace_callback('/some\/([^\/]+)\/([^\/]+).*/', function($x) {
return 'some/' . preg_replace('~\D+~', '', $x[1]) . '/' . $x[2];
}, $this_entered_uri);