标签: replace xregexp
var name = XRegExp('(?<first>\\w+) (?<last>\\w+)','g'); var strNew=XRegExp.replace('John Smith', name, '${last}, ${first}');//->John Smith
答案 0 :(得分:0)
它对我有用...检查您是否正确安装了XRegExp并打印出strNew而不是name
strNew
name