Suppose I want to escape all double-quotes which are nested within double quotes (picture a CSV or something):
"Jim", "Smythe", "Favorite Quote: "This is my favorite quote.""
I'd like to isolate the inner quotes which surround This is my favorite quote.
, and then escape them with a \
. But I'm having trouble writing a regex to just match on the inner quotes. So, the resulting match I'd like is:
"Jim", "Smythe", "Favorite Quote: "This is my favorite quote.""
^^ ^^
Start Match Here || || End Match Here
Start Capture Here | End Capture Here |
Match: "This is my favorite quote."
Capture: This is my favorite quote.
And then I can easily escape the quotes with the pattern \"$1\"
to get the end result:
"Jim", "Smythe", "Favorite Quote: \"This is my favorite quote.\""