我目前試圖驗證字符串格式EXTJS 5驗證 - 驗證後的4個字符輸入
1字符(AZ)和3個字符(AZ 0-9)(字母字符,然後進行3個字母數字)
這是我的自定義V型:
customalphanumeric: function(
return (/^([A-Za-z]){1}([A-Za-z0-9]){3}$/).test(v);
},
customalphanumericText: 'Please enter 1 Alpha character followed by 3 alphanumeric characters',
customalphanumericMask: /([A-Za-z0-9])/
當我輸入任何字母到框中的文本顯示了「請輸入1個字母字符後跟3個字母數字字符」。
如何讓它等待輸入4個字符?
我試過這樣:
if (v.length == 4) {
return (/^([A-Za-z]){1}([A-Za-z0-9]){3}$/).test(v);
}
else {
return true;
}
但允許少於4個字符的短語。任何幫助將非常感激。
我明白你在說什麼。這是一個更好的解決方案。謝謝。 – user4067565 2014-10-13 12:04:39