1
返回false
我有以下的RegularExpressionValidator:正則表達式的作品上的RegularExpressionValidator但Regex.IsMatch
<asp:RegularExpressionValidator CssClass="Validator_alert" ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtPassword"
ErrorMessage="Dit kodeord skal være mindst 6 tegn langt og indholde et tal, et stort bogstav og lille bogstav. Kodeordet må ikke indeholde tegnene & og %."
ValidationExpression="(?!^[0-9]*$)(?!^[a-z])(?!^[A-Z]*$)^([[email protected]_:;+]{6,50})$"
SetFocusOnError="true" />
背後下面的代碼檢查藏漢表達:
string pattern = @"(?!^[0-9]*$)(?!^[a-z])(?!^[A-Z]*$)^([[email protected]_:;+]{6,50})$";
Boolean meetsRequirements = false;
meetsRequirements = System.Text.RegularExpressions.Regex.IsMatch(pattern, txtPassword.Value);
meetsRequirements = System.Text.RegularExpressions.Regex.IsMatch(pattern, txtPasswordRepeat.Value);
return meetsRequirements;
爲什麼IsMatch回報假,當txtPassword.Value
和txtPasswordRepeat.Value中的值通過前端(RegularExpressionValidator)測試時?
衛生署!謝謝。 :) – Kenci 2013-03-26 11:47:52