3v4l.org

run code in 300+ PHP versions simultaneously
<?php $routes = [ '/path/(\d+)/new/upload$', '/path/selectable_ajax_placements/(\w+)/(\d+)', '/path/anotherpath/to/(\d+)/from/([\d\-\_]+)/to/([\d\-\_]+)$', '/path/([\d\w]+)/yayanotherpath/([\d\w]+)/list$', ]; foreach ($routes as $route) { echo preg_replace('#/(.*?[!a-z0-9_\-].*?)(?=/)#i', '<regex>', $route), "\n"; }

preferences:
34.66 ms | 402 KiB | 5 Q