<body>
<input type="text"   />
<br /><br /> <hr />

<script type="text/javascript" >
function check(){
	var re=/(1)((2)3)/g;
	var arr;
	var src =document.getElementById("txtInput").value ;
	
	document.write(src + "<br>");

	while ((arr = re.exec(src)) != null)
	// debugger;		//arr返回一个数组.length为(组)的个数,
	if(arr!=null){
       document.write('test:'+arr[1]+',idx:'+ arr.index + ",LastIdx:" + arr.lastIndex + ",Value:" + arr+ "<br>");
	}else {alert('null');}
}
/*
d123d123
test:1,idx:1,LastIdx:4,Value:123,1,23,2
test:1,idx:5,LastIdx:8,Value:123,1,23,2
*/
</script>
</body>
</html>

相关文章:

  • 2022-12-23
  • 2021-08-12
  • 2021-05-19
  • 2021-08-30
  • 2021-08-23
  • 2021-08-24
  • 2021-06-01
  • 2022-01-02
猜你喜欢
  • 2021-07-10
  • 2022-02-25
  • 2021-06-25
  • 2021-07-21
  • 2021-05-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案