how to strip punctuation in php

Okan Kocyigit picture Okan Kocyigit · Mar 8, 2011 · Viewed 22.5k times · Source

How can I strip punctuation except for these characters . = $ ' - %

Answer

Waiyl Karim picture Waiyl Karim · Aug 26, 2013

Here's a neat way to do it:

preg_replace("#[[:punct:]]#", "", $target);