2010-12-02 80 views

回答

18

根據this site ...

preg_match('/^[a-z\d.]{5,}$/i', $username); 
+0

就是這樣.. TNX – user495208 2010-12-02 00:13:34

+2

還必須至少有5個字符。查找「用戶名也必須至少有5個字符。」在「我想要的用戶名不可用」 https://www.facebook.com/help/?page=897 – Andrew 2011-03-24 19:41:09

1
var pattern=/[[email protected]#$%^&<>]/; 

var name=$username; 

var count=0; 

if(pattern.test(name)) 
{ 
    alert('only characters'); 
} 

if(name.match(/[0-9]/)) 
{ 

    count++; 
    if(count>5) 
    alert('not exceds 5 digits'); 
}