Regex Find Quotes Inside Quotes
Basically we can use a capturing group s backreference to tell the regex engine that a string should end with the same quote character that started it.
Regex find quotes inside quotes. Back to the future regex i to account for this you might inject a lookahead inside your negative lookbehind. And you want a regex to find the search string in the input. String not inside quotes regex. This is what i call a back to the future regex.
What a great opportunity to explore how useful backreferences can be. This won t work with just a regex as your search isn t a regex nor is it a string that matches the input. I have been fiddling around with the following pattern but it seems to only match strings on the. Regex to delimit at spaces except inside of quotes i am building a program to analyze some javascript and i need it to split at spaces but keep together entire quoted blocks so that i have a list of every word or connected word block.
You need to find a followed by any number of characters that are not a and then w a quoted word and then finally any additional number of non quote characters a final quote. Without that i really can t use the regex because even if i did an indexof on the sign i may be getting the index inside the quotes. The lookahead inside the lookbehind asserts that after we ve found the opening double quote behind tarzan we can find tarzan surprise and a closing double. Regular expression to capture all strings with and in between quotes all nested quotes.
I greatly appreciate the help. I am trying to write a regular expression that will match all double quoted strings across newlines.