<!DOCTYPE html>
<html>
<head lang="en">
  <meta charset="UTF-8">
  <title>替换</title>
</head>
<body>

<script>
  var reg=new RegExp("Paul");
  var stringObj="Paul Paula Pauline";
  var newstr=stringObj.replace(reg,"Ringo");
  alert(newstr);
</script>
</body>
</html>