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

前端 未结 9 739
一生所求
一生所求 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:43

    Considering that I didn't even know about the "*?" thing until today, and I've been using regular expressions for 20+ years, I'd vote in favour of the first. It certainly makes it clear what you're trying to do - you're trying to match a string that doesn't include quotes.

提交回复
热议问题