简单问题。 如何检测我的字符串是否在输入键上包含两个相同的字符。我更喜欢在jquery
中这样做array_combine($validator->messages()->keys(),$validator->messages()->all())
我已经尝试了
test >> true
abcd >> false
但这不起作用
答案 0 :(得分:1)
试试这个......
var input = $('inputId').value;
var count = (input.match(/t/g) || []).length; // 't' is a search string
if(count > 1)
return true;
else
return false;
答案 1 :(得分:0)
试试这个==>
var str= $('inputId').value;
var hasrepeat = (/([a-zA-Z]).*?\1/).test(str)
alert(hasrepeat); // return true OR false if true=repeat false= Not repeat