RegEx: Grabbing values between quotation marks

前端 未结 20 1258
暖寄归人
暖寄归人 2020-11-22 02:13

I have a value like this:

\"Foo Bar\" \"Another Value\" something else

What regex will return the

20条回答
  •  死守一世寂寞
    2020-11-22 02:39

    This version

    • accounts for escaped quotes
    • controls backtracking

      /(["'])((?:(?!\1)[^\\]|(?:\\\\)*\\[^\\])*)\1/
      

提交回复
热议问题