limitphp Posted February 19, 2009 Share Posted February 19, 2009 If I want to allow letters, numbers, spaces and single quotes? I tried this: preg_match("#^[a-z0-9 ']+$#i", $value) and this: preg_match("#^[a-z0-9 \']+$#i", $value) neither worked.... Quote Link to comment https://forums.phpfreaks.com/topic/145995-solved-how-do-you-match-a-single-quote/ Share on other sites More sharing options...
sasa Posted February 19, 2009 Share Posted February 19, 2009 try preg_match("#^[a-z0-9 ']+$#i", stripslashes($value)) Quote Link to comment https://forums.phpfreaks.com/topic/145995-solved-how-do-you-match-a-single-quote/#findComment-766472 Share on other sites More sharing options...
limitphp Posted February 19, 2009 Author Share Posted February 19, 2009 If I want to allow letters, numbers, spaces and single quotes? I tried this: preg_match("#^[a-z0-9 ']+$#i", $value) and this: preg_match("#^[a-z0-9 \']+$#i", $value) neither worked.... I'm blind.....I had the wrong variable in there.....it was something different than $value.... its working now with this: preg_match("#^[a-z0-9 ']+$#i", $value) thanks for the help though sasa.... Quote Link to comment https://forums.phpfreaks.com/topic/145995-solved-how-do-you-match-a-single-quote/#findComment-766496 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.