Skip to content

Instantly share code, notes, and snippets.

@mapkyca
Created April 19, 2012 12:52
Show Gist options
  • Save mapkyca/2420795 to your computer and use it in GitHub Desktop.
Save mapkyca/2420795 to your computer and use it in GitHub Desktop.
Quickly remove non-alpha chars from a string
// Quick regexp to remove non-alpha chars from a string. Very handy
$string = preg_replace("/[^a-zA-Z0-9\s]/", "", $string);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment