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.... 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)) 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.... 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
Archived
This topic is now archived and is closed to further replies.