KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to remove, via regular expression, all but alphanumeric characters & spaces. Here's the conversion I am hoping to achieve. "I am a string" → "I am a string" "How are you?" → "How are you" "#53-Jeff" → "53-Jeff" So far I have this: return preg_replace("/[^0-9a-zA-Z]/","", $val); But being a regex novice, I can't figure out how to insert a space. I had odd results when I tried.
Tags (comma-separated)
Save Edits
Cancel