I want to replace all non printable characters, especially emojis from a text but want to retain the newline characters like \n and \r
I currently have this for escaping the non printable characters but it escapes \n and \r also:
preg_replace('/[[:^print:]]/', '', $value);