Snippet Name: Filter non-alphanumeric characters Description: Filters out all non-alphanumeric characters (a through z and 0 through 9). Useful for filtering or sanitizing input data. Also see:» Neatly trim a string to a set number o... » Search array elements for a substring » Add a period at the end of a string if... » Count capital letters in a string » Search All Words Of A String In mySQL » Remove Extra Spaces From A String » Get Query String with Javascript » Create string by formatting an amount ... » Search PL/SQL for a string/ key value » INSTR (InString) » SUBSTR (SubString) » Generate unique strings of random numb... » String Functions: REVERSE » String Functions: LENGTH » String Functions: INSTR » String Functions: CONCAT » String Functions: CHAR » String Functions: INITCAP » String Functions: LOWER » String Functions: UPPER » Sort comma separated string » Censor Message Text » String to Date » Generate random string » Vulnerability Tester » De-Pluralize a String » Add string to field » Column copy with string replacement » Extract part of a string » Finding a substring in a string Comment: (none) Language: PHP Highlight Mode: PHP Last Modified: March 16th, 2009
Description: Filters out all non-alphanumeric characters (a through z and 0 through 9). Useful for filtering or sanitizing input data.
Also see:» Neatly trim a string to a set number o... » Search array elements for a substring » Add a period at the end of a string if... » Count capital letters in a string » Search All Words Of A String In mySQL » Remove Extra Spaces From A String » Get Query String with Javascript » Create string by formatting an amount ... » Search PL/SQL for a string/ key value » INSTR (InString) » SUBSTR (SubString) » Generate unique strings of random numb... » String Functions: REVERSE » String Functions: LENGTH » String Functions: INSTR » String Functions: CONCAT » String Functions: CHAR » String Functions: INITCAP » String Functions: LOWER » String Functions: UPPER » Sort comma separated string » Censor Message Text » String to Date » Generate random string » Vulnerability Tester » De-Pluralize a String » Add string to field » Column copy with string replacement » Extract part of a string » Finding a substring in a string
<?PHP //Begin filtering variable $data of non alphanumeric characters $data = PREG_REPLACE("/[^0-9a-zA-Z]/i", '', $data); //Finish filtering of non alphanumeric characters ?>