javascript regex to select quoted string but not escape quotes

前端 未结 4 695
南旧
南旧 2021-01-19 05:06

Original string:

some text \"some \\\"string\\\"right here \"

Want to get:

\"some \\\"string\\\"right here\"
4条回答
  •  暖寄归人
    2021-01-19 05:51

    You can use this regex :

    /[^\\](\".*?[^\\]\")/g
    

    [^\\] catch any caracter diferent of \. So \" will not be catch as start or end of your match.

提交回复
热议问题