javascript 中的replace方法
Posted on 2004-12-16 16:20 min 阅读(622) 评论(2) 编辑 收藏 href="http://www.cnblogs.com/mindotnet/Services/Pingback.aspx" rel="pingback"/>第一次发现javascript中replace() 方法如果直接用str.replace("-","!") 只会替换第一个匹配的字符.


(a regular expression) with the text of the second argument (a string).
If the g (global) flag is not set in the regular expression declaration, this method replaces only the first
occurrence of the pattern. For example,




perform a global replace, finding and replacing every matching substring. For example,



