How can I match double-quoted strings with escaped double-quote characters?

前端 未结 7 1240
既然无缘
既然无缘 2020-12-05 00:08

I need a Perl regular expression to match a string. I\'m assuming only double-quoted strings, that a \\\" is a literal quote character and NOT the end of the string, and tha

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-05 00:55

    Here's a very simple way:

    /"(?:\\?.)*?"/
    

    Just remember if you're embedding such a regex in a string to double the backslashes.

提交回复
热议问题