davey10101 Posted February 19, 2010 Share Posted February 19, 2010 Hi, I'm trying to make it so that the data allows characters for a name entry OR can be null string (so they don't have to give their name but if they do it must contain the obvious non numbers). Cheers... if(!preg_match("/^[A-Z a-z\s]{1,30}$/",$data[12])) Link to comment https://forums.phpfreaks.com/topic/192680-allow-a-za-z-or-null-ie-optional-non-entry/ Share on other sites More sharing options...
sader Posted February 20, 2010 Share Posted February 20, 2010 preg_match('/^[a-z ]{1,32}$/im', $str) Link to comment https://forums.phpfreaks.com/topic/192680-allow-a-za-z-or-null-ie-optional-non-entry/#findComment-1015068 Share on other sites More sharing options...
salathe Posted February 20, 2010 Share Posted February 20, 2010 Just change the 1 in {1,30} to 0. Link to comment https://forums.phpfreaks.com/topic/192680-allow-a-za-z-or-null-ie-optional-non-entry/#findComment-1015071 Share on other sites More sharing options...
davey10101 Posted February 20, 2010 Author Share Posted February 20, 2010 omg thats soooo obvious now. Had been coding all day and couldn't see it lol. Thanks Link to comment https://forums.phpfreaks.com/topic/192680-allow-a-za-z-or-null-ie-optional-non-entry/#findComment-1015276 Share on other sites More sharing options...
salathe Posted February 21, 2010 Share Posted February 21, 2010 Hehe no worries davey. Don't forget to mark the topic solved if it is. Link to comment https://forums.phpfreaks.com/topic/192680-allow-a-za-z-or-null-ie-optional-non-entry/#findComment-1015633 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.