我創建一個密碼驗證程序,它採用任何字符,但空格和至少6個字符。正則表達式,任何字符,但一個空格
尋找最佳後,我想出了是,這是這個例子: What is the regular expression for matching that contains no white space in between text?
它不允許任何其間的空間,但允許啓動,並用空格結束。我想禁止傳遞字符串中的任何空格。
我試過,但它不工作:
if (preg_match("/^[^\s]+[\S+][^\s]{6}$/", $string)) {
return true;
} else {
return false;
}
感謝。
Dumb問題:爲什麼要阻止用戶在密碼中使用空格? – Mike