Skip to content

Instantly share code, notes, and snippets.

@pjendrusik
Created June 29, 2016 13:09
Show Gist options
  • Save pjendrusik/156271e62d5925e28fee126613975c45 to your computer and use it in GitHub Desktop.
Save pjendrusik/156271e62d5925e28fee126613975c45 to your computer and use it in GitHub Desktop.
If the input is utf8-encoded, might use unicode regex to match/strip invisible control characters like e2808e (left-to-right-mark). Use u (PCRE_UTF8) modifier and \p{C} or \p{Other}.
Strip out all invisibles:
$str = preg_replace('/\p{C}+/u', "", $str);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment