正则表达式隔离" 分配给数字的引号



我需要隔离并替换分配给字符而不是数字的双引号。

例如:我买了4";胶合板;存储

基本上我想罚款并替换";分配给a的,并保留分配给数字的,因此结果应该是我买了4";商店的胶合板

谢谢

尝试匹配char + "并在字符串中替换它(删除"(:

let str = "I bought 4" plywood from a" store";
let match = str.match(/([A-Za-z]")/i);
let res = str.replace(/([A-Za-z]")/i, match[0].replace(""", ""));
console.log(res);

最新更新