PHP正则表达式添加某些字符

I have the following regex that allows any letter and number (and I think uppercase too)!

What I need is to allow certain characters such as a - value and only that.

How would I insert that into this?

$reg = preg_replace('/[^a-z0-9 ]/i', '', $reg);

You can add additional characters inside the brackets like this:

$reg = preg_replace('/[^a-z0-9 \-]/i', '', $reg);

If you meant that you want the expression inside the brackets or a minus, you can use this:

$reg = preg_replace('/([^a-z0-9 ]|\-)/i', '', $reg);

Not tested, but I think thats it.