I need a regex that would get all the text inside quotes ( ", ' ) For Example:
import re
i = 'Test Text 1 "Test Text 2"'
re.compile(regex).findall(i)
# Returns: ['"Test Text 2', '"']
Till now, I've made this regex:
regex = ("(')([^']+)?|(\")([^\"]+)?")
And this works pretty well, tho there is a problem. I want it to work like python quotes color coding system, so I want it to not stop the element if there is a backslash before the end quote. For Example:
import re
i = 'Test Text 1 "Test Text \\" 2"'
re.compile(regex).findall(i)
# Returns: ['"Test Text " 2', '"']
'"Test Text \\\\"'
then it should not ignore it, as I said, exactly like python quotes color coding. Basically as you said, even number of backslashes shouldn't be ignored