I'm using this
$string = preg_replace('/[\x00-\x1F\x7F\xA0]/u', '', $string);
That regex is from this link PHP: How to remove all non printable characters in a string?
The regex is removing \n
but I would like to keep it.
What should I do?
I think \n
is 000A
, so I've tried something like this (it will make all the regex stoping working)
$string = preg_replace('/[\x00-\x1F\x7F\xA0[ˆ\x0A]]/u', '', $string);
I appreciate any help.