title: Regular Expression in Python 3
body: <p>I am new here and just start using regular expressions in my python codes. I have a string which has 6 commas inside. One of the commas is fallen between two quotation marks. I want to get rid of the quotation marks and the last comma.</p>
  
  <p>The input: </p>
  
  <pre><code>string = 'Fruits,Pear,Cherry,Apple,Orange,"Cherry,"'
  </code></pre>
  
  <p>I want this output:                        </p>
  
  <pre><code>string = 'Fruits,Pear,Cherry,Apple,Orange,Cherry'         
  </code></pre>
  
  <p>The output of my code:               </p>
  
  <pre><code>string = 'Fruits,Pear,**CherryApple**,Orange,Cherry'
  </code></pre>
  
  <p>here is my code in python:</p>
  
  <pre><code>if (re.search('"', string)):
      matches  = re.findall(r'\"(.+?)\"',string);
      matches1 = re.sub(",", "", matches[0]);
      string   = re.sub(matches[0],matches1,string);
      string   = re.sub('"','',string);
  </code></pre>
  
  <p>My problem is, I want to give a condition that the code only works for the last bit ("Cherry,") but unfortunately it affects other words in the middle (Cherry,Apple), which has the same text as the one between the quotation marks! That results in reducing the number of commas (from 6 to 4) as it merges two fields (Cherry,Apple) and I want to be left with 5 commas.</p>
  
  <pre><code>fullString = '2000-04-24 12:32:00.000,22186CBD0FDEAB049C60513341BA721B,0DDEB5,COMP,Ch‌​erry Corp.,DE,100,0.57,100,31213C678CC483768E1282A9D8CB524C,365.0‌​0000,business,acquis‌​itions-mergers,acqui‌​sition-bid,interest,‌​acquiree,fact,,,,,,,‌​,,,,,,acquisition-in‌​terest-acquiree,Cher‌​ry Corp. Gets Buyout Offer From Chairman President,FULL-ARTICLE,B5569E,Dow Jones Newswires,0.04,-0.18,0,0,1,0,0,0,0,1,1,5,RPA,DJ,DN2000042400‌​0597,"Cherry Corp. Gets Buyout Offer From Chairman President,"\n'
  </code></pre>
  
  <p>Many Thanks in advance</p>