<script> function replacer(word) { return 'hello'; } var newString = 'abc[你好]de[他]fg'.replace(/^\[[^\u0000-\u00FF]{1,2}\]$/gi, replacer); alert(newString)//todo:為什么這里顯示的不是hellohello,我想把[你好][他]替換成hello </script>
javascript如何使用replace替換?
鴻蒙傳說
2018-11-14 13:14:08