http://php.net/manual/en/function.preg-replace.php
mixed preg_replace ( mixed $pattern , mixed $replacement , mixed $subject [, int $limit = -1 [, int &$count ]] );
在你的情况下,它应该是这样的:
$subject = 'hello-world-093' ;
$subject_stripped = preg_replace ( '/-[0-9]*$/' , '' , $subject);
Run Code Online (Sandbox Code Playgroud)
上述模式将删除-字符串末尾的所有数字。