首頁 > 問答 > 主體
天蓬老师2017-05-19 10:37:44
不要匹配開始^和匹配末尾$
function replacer(word) { return 'hello'; } var newString = 'abc[你好]de[他]fg'.replace(/\[[^\u0000-\u00FF]{1,2}\]/gi, replacer);