Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
XRegExp replace无法获取匹配字符串 var name=XRegExp('(?\\w+(\\w+),'g'); var strNew=XRegExp.replace('John Smith',name,${last},${first}');//->约翰·史密斯_Replace_Xregexp - Fatal编程技术网

XRegExp replace无法获取匹配字符串 var name=XRegExp('(?\\w+(\\w+),'g'); var strNew=XRegExp.replace('John Smith',name,${last},${first}');//->约翰·史密斯

XRegExp replace无法获取匹配字符串 var name=XRegExp('(?\\w+(\\w+),'g'); var strNew=XRegExp.replace('John Smith',name,${last},${first}');//->约翰·史密斯,replace,xregexp,Replace,Xregexp,为什么strNew是“John Smith”而不是“Smith,John”?它对我很有用…检查您是否正确安装了XRegExp,并且正在打印strNew而不是namevar name=XRegExp(“(?\\w+?\\w+”,“g”);var strNew=XRegExp.replace('John Smith',name,${last},${first}');控制台日志(strNew) var name = XRegExp('(?<first>\\w+) (?<last>

为什么strNew是“John Smith”而不是“Smith,John”?

它对我很有用…检查您是否正确安装了XRegExp,并且正在打印
strNew
而不是
name

var name=XRegExp(“(?\\w+?\\w+”,“g”);var strNew=XRegExp.replace('John Smith',name,${last},${first}');控制台日志(strNew)
var name = XRegExp('(?<first>\\w+) (?<last>\\w+)','g');
var strNew=XRegExp.replace('John Smith', name, '${last}, ${first}');//->John Smith