PHP regular expressions that allow some symbols?

Christopher

New member
Ok so I'm not going to confuse you with my whole code but below is the code you'll need to help me:

$strip = "/[^A-Za-z0-9]/";
$clean = preg_replace($strip,"","$tag");

So with $strip it will clean out (replace) everything that is not A - Z, a - z, or 0 -9. However I would also like the regular expression to allow other characters such as these: - _ , . ? !

Later on I may need to allow others, but If anyone could give me a hand on altering my regular expression to include these I'm sure I can figure it out for the future. Also, if you guys know any great sites/ resources to reference PHP regular expressions I'd greatly appreciate it.
 
Back
Top