How can I match a space character in a PHP regular expression?

I mean like “gavin schulz”, the space in between the two words. I am using a regular expression to make sure that I only allow letters, number and a space. But I’m not sure how to find the space. This is what I have right now:

$newtag = preg_replace("/[^a-zA-Z0-9s|]/", "", $tag);

9 Answers
9

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *