I am looking to remove all alpha-numeric characters from a string and replace with a space (using PHP). The input is coming from a textarea that has data pasted into it from various places like word, excel, websites, emails etc.
I was using this regex
/[^a-zA-Z0-9\s]/
But I found that there are still Vertical Tabs (ascii #13). I want my end result to only include letters and numbers, no newline, tab, vertical tabs etc
Many thanks!
Vertical tabs are matched by the whitespace character (
\s)If you want to replace every non-alpha-numeric character with a space, use
If you want to replace every group (consecutive characters) of non-alnums with a single space, use