逗号到底在正则中又没有特殊含义??
<html>
<body>
<script type="text/javascript">
var str = "Visit W3School, W3School, is, a place to study web technology.";
var patt = new RegExp(",","g");
var result;
while ((result = patt.exec(str)) != undefined) {
document.write(result);
document.write("<br />");
document.write(result.index);
document.write("<br />");
}
document.write(str.match(patt));
</script>
</body>
</html>
结果,为什么不一样呢
,
14
,
24
,
28
,,,,,