title: Python: multiline regular expression problem
body: <p>I have a very long string, the first lines of which are:</p>
  
  <pre><code>text = """
  
  
  
  
  [text begins here] ... """
  </code></pre>
  
  <p>I want to remove all the <code>\n</code> characters at the beginning of it, so that I get only something like:</p>
  
  <pre><code>text = """[text begins here] ... """
  </code></pre>
  
  <p>I'm trying the following:</p>
  
  <pre><code>pattern = r"^\n*"
  search = re.compile(pattern, re.S)
  out = re.sub(pattern, "", text)
  </code></pre>
  
  <p>But it doesn't catch or replace anything.</p>
  
  <p>How can I fix this?</p>
  
  <p>(Note: I need to use RegEx for this, not string slicing or other methods.)</p>