title: Regular Expressions with python
body: <p>The question is: </p>
  
  <blockquote>
    <p>Write a script that reads a text a file, splits it into sentences, and
    print the sentences on the screen, one after the other. Do not use
    libraries that do sentence-splitting for you.</p>
  </blockquote>
  
  <p>The following is my code:</p>
  
  <pre><code>import re
  fr=open('input.txt')
  text=fr.read().strip()
  fr.close()
  Ms=re.finditer(' +([A-Z].+?\.) ',text)
  for i in Ms:
      print i.group(1)
  </code></pre>
  
  <p>The result shows nothing. Actually I know what's maybe wrong because the first sentence of the file doesn't have multiple spaces ahead, but I can't figure out how to fix it.</p>
  
  <p>The following is my input:</p>
  
  <p>Metformin will reach full effectiveness in 6-8 weeks. It has three primary effects (<a href="http://en.wikipedia.org/wiki/Metformin#Mechanism4of_action" rel="nofollow">http://en.wikipedia.org/wiki/Metformin#Mechanism4of_action</a>).</p>
  
  <p>First, it (frequently) reduces the amount of blood sugar produced by your liver, this presumably will decrease your basal needs and help your fasting numbers.</p>
  
  <p>Second, metformin increases the insulin, signaling resulting in increased insulin sensitivity: <a href="http://care.diabetesjournals.org/content/27/1/281.full" rel="nofollow">http://care.diabetesjournals.org/content/27/1/281.full</a>. 
  The effect is primarily on the muscle mass in your body.
  Insulin resistance also affects all kinds of other stuff, but the biggest utilization of insulin is in the uptake of glucose to muscles.</p>
  
  <p>Third, Metformin decreases the absorption of glucose during digestion.It is this effect that I believe causes some of the gastric issues.</p>