Hi there,
How can ik allow a space in my regular expression:
PHP Code:function checkSyntaxTussenvoegsel($string){
$regexp="^[a-zA-Z.'-]{0,10}$";
if(!ereg($regexp,$string)){
return false;
}
else{
return true;
}
}
| SitePoint Sponsor |
Hi there,
How can ik allow a space in my regular expression:
PHP Code:function checkSyntaxTussenvoegsel($string){
$regexp="^[a-zA-Z.'-]{0,10}$";
if(!ereg($regexp,$string)){
return false;
}
else{
return true;
}
}





\s is the character for a space.
Sam Hastings




Actually no, you simply use a space for a space. preg_match('/^[a-z ]+$/','a b c') returns 1. \s matches any whitespace character, such as a linebreak or a carriage return, or a tab. But yeah, it does match a space, tooOriginally Posted by SJH
![]()
Bookmarks