November 23rd, 2008, 06:50 PM
[SOLVED] Finding "Strings" (enclosed by quoetes) using RegEx
I am trying to find all strings (enclosed by quotes) using a regular expression.
My first attempt was:
But that was too greedy...
So my second attempt was:
... which seemed to work... until I realized that it failed for escaped strings...
so I am trying to make a regular expression that will handle this case:
" my cool expression handles \"escaped quotes\" too!"
AWESOME IDEA UPDATE: I could have my regular expression look for \\" OR ^". How could I do that?
AWESOME ANSWER UPDATE: I found my answer...
"(\\"|[^"])*" seems to work... Just letting you know incase someone else has the same problem.
Last edited by videoediting; November 23rd, 2008 at 07:45 PM.
November 24th, 2008, 01:02 AM
But what happens if you want to escape the '\'?
Hi, "first an escape \" and this is a backslash: \\", and we're outside the quotes again.