读书人

js中施用正则表达式实现replaceAll方法

发布时间: 2012-09-08 10:48:07 作者: rapoo

js中使用正则表达式实现replaceAll方法

http://www.360doc.com/content/11/0407/20/2956608_108008354.shtml

<html><head><title></title><script language="javascript">function replaceAll(){var oldValue = "abcdea";var newValue = oldValue.replace(new RegExp("\a","gm"),"x");alert("oldValue="+oldValue+"\n"+"newValue="+newValue);}replaceAll();</script></head><body></body></html>
?

读书人网 >JavaScript

热点推荐