Design a regex that matches all the expected characters you expect to see inside the quoted string. Then use a python method findallto re, to find all occurrences of the match.
import re
buffer = open('file.txt','r').read()
quotes = re.findall(r'"[^"]*"',buffer)
for quote in quotes:
print quote
A search between "and" requires a search in the form of unicode-regex, for example:
quotes = re.findall(ur'"[^\u201d]*\u201d',buffer)
And for a document that uses "and" interchangeably to complete a quote
quotes = re.findall(ur'"[^"^\u201d]*["\u201d]', buffer)
source
share