日期:2014-05-16 浏览次数:20377 次
<html>
<body>
<script type="text/javascript">
var str = "Visit W3School, W3School is a place to study web technology.";
var patt = new RegExp("W3School");
var result;
while ((result = patt.exec(str)) != null) {
document.write(result);
document.write("<br />");
document.write(patt.lastIndex);
document.write("<br />");
}
</script>
</body>
</html>