I use the following for a preg_replace:
$replace = '/[!\/."",#\s\-:?"]+/';
For example when I try and add ' above it gives me an error on the file:
Parse error: syntax error, unexpected T_NS_SEPARATOR in …/s.php on line 38
Additionally, is there an easier way to list all of the symbols to be replaced?
If you want to get rid of any symbol, try:
The
^indicates “anything but the following”. Add whatever characters you want to allow to the list. It’s easier than listing every symbol and having to deal with escaping.