更新时间:2022-12-10 23:28:16
str = "hello, my name is \"michael\", my friend's is \"bob\". what's yours?";
str.replace(/"([^"]+)"/g, '<span class="name">$1</span>');
输出:
hello, my name is <span class="name">michael</span>, my friend's is <span class="name">bob</span>. what's your's?