87,993
社区成员
发帖
与我相关
我的任务
分享
石头君好哇...^(?!,)(?:\b,?([a-zA-Z0-9]+)\b(?!.*?\b\1\b))*
<script>
var p = /^(?!,)(?:\b,?([a-zA-Z0-9]+)\b(?!.*?\b\1\b))*$/;
alert(p.test('x,us,t,ta,6,i,t1'));
alert(p.test('x,us,t,ta,6,i,t'));
</script>
^(?!,)(?:,?\b([a-zA-Z0-9]+)\b(?!.*?\b\1\b))*$<script>
var p = /^(?!,)(?:,?\b([a-zA-Z0-9]+)\b(?!.*?\b\1\b))*$/;
alert(p.test('x,us,t,ta,6,i,t1'));
alert(p.test('x,us,t,ta,6,i,t'));
</script>
<!--
var str = "x,us,t,ta,6,i";
var b = false;
str.replace(/[0-9a-z]+/ig, function($1, index){
if(str.indexOf($1) != index) {
b = true;
}
})
!!b ? alert('有重复项') : alert('无重复项');
//-->
</script>