showing results for - "regex for anything but quoted strings site 3astackoverflow com"
Alberto
14 Jul 2016
1/(\B(".+?")\B|\B('.+?')\B|\B(`.+?`)\B)/g;
Emil
30 Jan 2020
1var rgx = /(\B(".+?")\B|\B('.+?')\B|\B(`.+?`)\B)/g;
2
3var str = `"Lorem ipsum dolor sit amet", consectetur adipisicing elit, "'sed do eiusmod tempor,'" incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, \`quis nostrud\` exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. \`Duis aute irure dolor\` in "reprehenderit in voluptate" velit esse cillum 'dolore eu fugiat nulla' pariatur. `;
4
5var sub = ``;
6
7var res = str.replace(rgx, sub);
8
9console.log(res);