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 Quote Link to comment Share on other sites More sharing options...
SteelSlasher Posted September 27, 2008 Share Posted September 27, 2008 try this http://uk3.php.net/trim Quote Link to comment 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.