Extracting string before the quotations
<p>I am trying to parse a pdf in python and extract string in quotations. I am able to extract the text in quotations but I also want to extract the name before the quotation starts.
For example:
Consider this</p>

<p>Ziblatt, Daniel. 2004. "Rethinking the Origins of Federalism: Puzzle, Theory, and Evidence from Nineteenth-Century Europe,"</p>

<p>I am able to extract everything quotations but I want the name to be extracted as well .
This is the code I am using.. Please help</p>

<pre><code>def quotes(x):
    quoted = re.compile('"[^"]*"')
    for value in quoted.findall(x):
        print value 
</code></pre>

<p>Capturing data before a double-quote should work:</p>

<pre><code>def quotes(x):
    quoted = re.compile('(.+)"[^"]+"')
    for value in quoted.findall(x):
        print value.strip()
</code></pre>

<p>I get this ouput:</p>

<pre><code>&gt;&gt;&gt; quotes(text)
'Ziblatt, Daniel. 2004.'
</code></pre>

python extract quotes