title: Regex with multiple lines and HTML tags
body: <p>I'm writing a script that should open 10 text files in turn (they are source codes from different webpages). I then want the script to go through and replace any instances of <code>&lt;br /&gt;</code> with <code>\n</code>. I then want it to delete the whole header, essentially. In any case, the document always starts with <code>DOCTYPE</code> and the last line before the information that I want ends </p>
  
  <pre><code>"decoration:underline"&gt;no year&lt;/span&gt;&lt;br /&gt;
  </code></pre>
  
  <p>As far as I'm aware, the regex <code>/.../s</code> means 'ignore line breaks', and I've escaped the HTML <code>/</code> that appears in the <code>&lt;/span&gt;</code> tag.
  So far, I have the following</p>
  
  <pre><code>import re
  def create_linebreaks(l):
      l = l.replace('&lt;br /&gt;', r'\n')
      return l
  def clean_up(line):
      line = re.sub(r'/^&lt;!DOCTYPE.+no year&lt;\/span&gt;/s', '', line)
      return line
  
  data = """&lt;!DOCTYPE html&gt;&lt;html class='v2' dir='ltr' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' movie/file/show/episodes is 2763.&lt;/p&gt;A LOAD OF OTHER HTML I DON'T WANT TO BE IN THE OUTPUT
  &lt;!-- google_ad_section_start(weight=ignore) --&gt;&lt;span class="listings"&gt;&lt;span style="font-size:large;font-weight:bold; text-decoration:underline"&gt;no year&lt;/span&gt;&lt;br /&gt;  &lt;b&gt;&lt;a target="_blank" href="http://movies.netflixable.com/224599"&gt;Beautiful Game, The&lt;/a&gt; (no year)&lt;/b&gt;&amp;nbsp;&amp;nbsp;&lt;i style="font-size:small"&gt; 3.5 stars, 1hr 24m&amp;nbsp;&amp;nbsp;&lt;a target="_blank" href="http://www.imdb.com/search/title?title=The Beautiful Game"&gt;imdb&lt;/a&gt;&lt;/i&gt;  &lt;img class="cc_img" src="http://bit.ly/VqRKtD" border="0" style="padding:0px !important;" title="Closed Captions: ---  - Danish  - Swedish  - Finnish  - Norwegian Bokm&amp;#65533;&amp;#65533;l  - English  " alt="Closed Captions: ---  - Danish  - Swedish  - Finnish  - Norwegian Bokm&amp;#65533;&amp;#65533;l  - English  " /&gt;  &lt;br /&gt;  &lt;br /&gt;  &lt;b&gt;&lt;a target="_blank" href="http://movies.netflixable.com/224278"&gt;Brave Miss World&lt;/a&gt; (no year)&lt;/b&gt;&amp;nbsp;&amp;nbsp;&lt;i style="font-size:small"&gt; 3.7 stars, 1hr 28m&amp;nbsp;&amp;nbsp;&lt;a target="_blank" href="http://www.imdb.com/search/title?title=Brave Miss World"&gt;imdb&lt;/a&gt;&lt;/i&gt;  &lt;img class="cc_img" src="http://bit.ly/VqRKtD" border="0" style="padding:0px !important;" title="Closed Captions: ---  - Danish  - Swedish  - Finnish  - Norwegian Bokm&amp;#65533;&amp;#65533;l  " alt="Closed Captions: ---  - Danish  - Swedish  - Finnish  - Norwegian Bokm&amp;#65533;&amp;#65533;l  " /&gt;  &lt;br /&gt;  &lt;br /&gt;"""
  
  create_linebreaks(data)
  clean_up(data)
  print data
  raw_input()
  </code></pre>
  
  <p>All I get out, however is the same string.</p>
  
  <p>Desired output is something like:</p>
  
  <pre><code>"""  &lt;b&gt;&lt;a target="_blank" href="http://movies.netflixable.com/224599"&gt;Beautiful Game, The&lt;/a&gt; (no year)&lt;/b&gt;&amp;nbsp;&amp;nbsp;&lt;i style="font-size:small"&gt; 3.5 stars, 1hr 24m&amp;nbsp;&amp;nbsp;&lt;a target="_blank" href="http://www.imdb.com/search/title?title=The Beautiful Game"&gt;imdb&lt;/a&gt;&lt;/i&gt;  &lt;img class="cc_img" src="http://bit.ly/VqRKtD" border="0" style="padding:0px !important;" title="Closed Captions: ---  - Danish  - Swedish  - Finnish  - Norwegian Bokm&amp;#65533;&amp;#65533;l  - English  " alt="Closed Captions: ---  - Danish  - Swedish  - Finnish  - Norwegian Bokm&amp;#65533;&amp;#65533;l  - English  " /&gt;  
  
  &lt;b&gt;&lt;a target="_blank" href="http://movies.netflixable.com/224278"&gt;Brave Miss World&lt;/a&gt; (no year)&lt;/b&gt;&amp;nbsp;&amp;nbsp;&lt;i style="font-size:small"&gt; 3.7 stars, 1hr 28m&amp;nbsp;&amp;nbsp;&lt;a target="_blank" href="http://www.imdb.com/search/title?title=Brave Miss World"&gt;imdb&lt;/a&gt;&lt;/i&gt;  &lt;img class="cc_img" src="http://bit.ly/VqRKtD" border="0" style="padding:0px !important;" title="Closed Captions: ---  - Danish  - Swedish  - Finnish  - Norwegian Bokm&amp;#65533;&amp;#65533;l  " alt="Closed Captions: ---  - Danish  - Swedish  - Finnish  - Norwegian Bokm&amp;#65533;&amp;#65533;l  " /&gt;  """
  </code></pre>