<!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8"> <title>RegExp</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>
运行结果如图所示:
原文地址:https://www.cnblogs.com/taogao3364/p/9866208.html
时间: 2024-11-14 12:40:39