title: ignoring newline character in regex match
body: <p>I am trying to replace all matching occurrences with title cases using the following script. When there is a newline character between filter words (in this case 'ABC' and 'DEF') that line doesn't get replaced as intended. </p>
  
  <p>How can I ignore the newline character in this case? </p>
  
  <p>Edit: I don't want to strip all newline characters entirely from the string, but only strip those between the filter words.</p>
  
  <p>Edit2: I edited the text and script to better reflect on the issue I am experiencing. If I include <code>flags=re.DOTALL</code> argument, it will give me: </p>
  
  <pre><code>  mmm    = "Hello Hello Hello Hello Hello Hello
                Hello Hello Hello Hello",
    Bbb   = "Bbb",
  </code></pre>
  
  <p>whereas the output I want is (notice that <code>bbb</code> is not capitalized):</p>
  
  <pre><code>  mmm    = "Hello Hello Hello Hello Hello Hello
                Hello Hello Hello Hello",
    bbb   = "bbb",
  </code></pre>
  
  <p>The following is the script I am using.</p>
  
  <pre><code>test_string = '''
    mmm    = "hello hello hello hello hello hello
                hello hello hello hello",
    bbb   = "bbb",
  '''
  
  rex = r'(?&lt;= mmm)(.*)(?=\")'
  
  def maketitle(match_obj):
      return match_obj.group(0).title()
  
  formatted = re.sub(rex, maketitle, test_string, flags=re.DOTALL)
  
  print(formatted)
  </code></pre>