Avatar of ike1492
ike1492
 asked on

Regular Expression Qestion - Reg Ex Question

Howdy!

Thanks for taking a look at this.  Can anyone tell me why this regular expression is removing spaces?  I think I've been staring at it for too long or something.

$myvar = preg_replace("/[^a-z\d.,-]/i", "", $myvar);

Thanks in advance!

ike1492
PHPMySQL ServerRegular Expressions

Avatar of undefined
Last Comment
ike1492

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Guy Hengel [angelIII / a3]

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Guy Hengel [angelIII / a3]

in code:

$myvar = preg_replace("/[^a-z\d\s.,-]/i", "", $myvar);
ike1492

ASKER
Glad it wasn't a snake! thanks very much!
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23