laravel string helper clear invisible character code example
Example 1: php regex non printable characters
myprompt> php -a
Interactive shell
php > $string = "‘Hello,’ she said.";
php > $result = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $string);
php > echo $result;
Hello, she said.
Example 2: php regex non printable characters
$result = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $string);