<?php $strings = [ 'controller_123/method///', 'controller_123/method/', '% con $trol@$@ler_!123/me*thod////', ]; var_export( preg_replace( '~[^-\w/]+|/\K/+$~', '', $strings ) );
You have javascript disabled. You will not be able to edit any code.