想替换的内容为
aaa[test]fvvsafds[test1]fdsfdsa[ccc]
替换成
aaa <aaa.test> fvvsafds <aaa.test1> fdsfdsa <aaa.ccc>
谢谢
------解决方案--------------------
<script>
alert( "aaa[test]fvvsafds[test1]fdsfdsa[ccc] ".replace(/\[(.*?)\]/g, " <aaa.$1> "))
</script>
------解决方案--------------------
var str= 'aaa[test]fvvsafds[test1]fdsfdsa[ccc] ';
alert(str.replace(/\[(.+?)\]/g, ' <aaa.$1> '));