LMSouq
php-dev Open

Matching a space in regex

GA
Gavin Schulz
1 month ago
3 views
Problem Description
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);

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base