Regex that captures between double quotes over multiple lines ignoring escaped double quotes [duplicate] - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Wednesday, December 6, 2023

Regex that captures between double quotes over multiple lines ignoring escaped double quotes [duplicate]

I need a regex that captures between double quotes (and single quotes, but for the sake of simplicity we'll ignore that) over multiple lines. The problem is that there might be escaped double quotes (\") in there too, which would stop the regex from searching in all of my attempts.

So here's an example: He said: "This is my \"example\" string" and ran off

The regex should match: This is my \"example\" string"

My current regex (/(["\'])(.*?)\1/) does match "This is my \" and " string" and which also doesn't work over multiple lines.



source https://stackoverflow.com/questions/77608082/regex-that-captures-between-double-quotes-over-multiple-lines-ignoring-escaped-d

No comments:

Post a Comment