📅  最后修改于: 2022-03-11 15:02:18.305000             🧑  作者: Mango
代码示例1
let re = /(\w+)\s(\w+)/;
let str = 'John Smith';
let newstr = str.replace(re, '$2, $1');
console.log(newstr); // Smith, John