将除[0-9] [az] [AZ]之外的所有字符转换为" - "如何在php中?

2 php regex preg-replace

我需要一种方法将除[0-9] [az] [AZ]之外的所有字符转换为" - "我如何在php中做到这一点谢谢!

Ry-*_*Ry- 9

$yourString = preg_replace("/[^0-9a-zA-Z]/", "-", $yourString);
Run Code Online (Sandbox Code Playgroud)

我认为应该这样做.