[英]Javascript Regex inside matched string
I have string like this 我有这样的字符串
<html>
[[Wayfinder? &startId=`0` &outerClass=`art-hmenu` ]] &
&
</html>
I want to change all &
我想更改所有&
that inside of [[
and ]]
will be replaced by &
[[
和]]
内部将由&
替换
How to do that with javascript? 如何使用javascript做到这一点?
str.replace(/\[\[(.*)?]]/, function(match) {
return match.replace(/&/g, '&');
});
Here's the fiddle: http://jsfiddle.net/Jtv5a/ 这是小提琴: http : //jsfiddle.net/Jtv5a/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.