I know this has been asked before, but I still can’t understand why the following is not working:
<?php
echo preg_replace('/(?:[?\p{L}]*\/)?(?:[?\w\-]*\/)?/', '$1', 'cafes/123456') . '<br />';
// '123456'
echo preg_replace('/(?:[?\p{L}]*\/)?(?:[?\w\-]*\/)?/', '$1', 'cafés/123456') . '<br />';
// 'café123456' where I expect 123456
echo preg_replace('/(?:[?\p{L}é]*\/)?(?:[?\w\-]*\/)?/', '$1', 'cafés/123456') . '<br />';
// '123456' thanks to the extra "é" after "\p{L}"
?>
Isn’t \p{L} supposed to replace any accent?
You are missing
umodifier that treats strings as UTF-8: