正则表达式的全部匹配

<html>
<body>

<script type="text/javascript">

var str="Microsoft hdh Microsoft";
document.write(str.replace(/Microsoft/g,"W3School"))

</script>
</body>
</html>

当加入/g后,就是匹配所有,不加的时候只是匹配第一个

原文地址:https://www.cnblogs.com/qingxuan/p/3259817.html