kee2ka4 Posted September 27, 2008 Share Posted September 27, 2008 Hello Peeps, I have use the following regular expression to validate my fields. $post_validations = array('body' => '/^[[:alnum:][:punct:][:space:]]{1,2000}$/'); Where the body field can start with any characters including space and punct and must have a minimum of one character to avoid empty values. My question is how can I add more validation to the regular exp so that if someone enters only a space character followed by no text, then the reg ex fails. So if I have the text ' this is an Example' then the reg exs passes as the character can start with a space but if I have the text ' ' then it should fail, since it only contains space tabs and no text, how can I add that validation to the reg ex Thanks, Zub Link to comment https://forums.phpfreaks.com/topic/126057-regular-expression-simple-question/ Share on other sites More sharing options...
SteelSlasher Posted September 27, 2008 Share Posted September 27, 2008 try this http://uk3.php.net/trim Link to comment https://forums.phpfreaks.com/topic/126057-regular-expression-simple-question/#findComment-651864 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.