How can I match a quote-delimited string with a regex?

前端 未结 9 738
一生所求
一生所求 2020-12-01 05:05

If I\'m trying to match a quote-delimited string with a regex, which of the following is \"better\" (where \"better\" means both more efficient and less likely to do somethi

9条回答
  •  青春惊慌失措
    2020-12-01 05:59

    I'd go for number two since it's much easier to read. But I'd still like to match empty strings so I would use:

    /".*?"/
    

提交回复
热议问题