110,534
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<title>test</title>
</head>
<script language="javascript">
/*
// Regex Example in JavaScript
// Rainsome Studio
// rainsome@126.com
// 2009-01-23 in Shanghai
*/
<!--//
function Test(strinput)
{
var regex1 = /\d{3}\-\d{10}/g;
var arrMatches = strinput.match(regex1);
var result="Result : \n";
var i=0;
var match;
for(var j=0;j<arrMatches.length;j++)
{
i++;
match = arrMatches[j];
result = result + "No " + i + " : " + match + "\n"
}
alert(result);
}
//-->
</script>
<body>
<input type="text" value="ww123-1234567890adf143-1234567890" onblur="javascript:Test(this.value);" size="100"/>
</body>
</html>