我有一个弦 "@{Name; [email protected]}"
我想编写一个从上述字符串中提取Name
并提取的正则表达式11112121
这就是我尝试过的。
function formatName(text){
var regex = /@\{([^;]+); ([^\}]+)\}/
return text.replace(
regex,
'$1, $2'
);
}
以上给出Name, [email protected]
。但我只想要Name, 11112121
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句