flyersun Posted January 22, 2007 Share Posted January 22, 2007 I've created an input form and a validation script. Within the validation script I'm using alot of reg expressions most of these work but I'm having problems with two of them. When I input a address like which contains numbers, letters and spaces I get an error message even though this string should allow them.Anyone have any ideas why? //Validate the address if (eregi ('^[[:alpha:]][0-9][[:blank:]]{2,40}$', stripslashes($_POST['address']))){ $address = $_POST['address']; }else{ //A correct address has not been entered $errorString .= "Please enter your address<br>\n"; } Quote Link to comment Share on other sites More sharing options...
trq Posted January 23, 2007 Share Posted January 23, 2007 That regex says that your string must start with any number of letters, proceeded by any number of numbers, finishing with a blank space.What do your address strings actually look like? Quote Link to comment Share on other sites More sharing options...
flyersun Posted January 23, 2007 Author Share Posted January 23, 2007 Well I was using my address to text it but I would rather not post it here so I will just give an example of the sort of thing I'm tring to enter.110 new street Quote Link to comment Share on other sites More sharing options...
effigy Posted January 23, 2007 Share Posted January 23, 2007 Ereg's aren't my specialty, but it looks like you're asking for 1 alpha character, 1 digit, and anywhere from 2 to 40 blanks--which doesn't match the address you provided. 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.