title: Multiple string replacements in one string
body: <p>I have got a string <code>alphabet = "abcdefghijklmn"</code> and would like to replace each vowel in the string with values from a substitution matrix <code>matrix = { 'a' : 'FIRST VOWEL', 'e' : 'SECOND VOWEL', 'i' : 'THIRD VOWEL' }</code>. I guess this is a case for recursion, so I tried the following function:</p>
  
  <pre><code>import re
  
  def iterrepl(string):
      m = re.search(r'[aeiou]',string)
      if m:
           string = string[:m.start()]+matrix.get(m.group())+string[m.end():]
           iterrepl(string)
      else:
           return(string)
  
  matrix = { 'a' : 'FIRST VOWEL', 'e' : 'SECOND VOWEL', 'i' : 'THIRD VOWEL' }
  alphabet = "abcdefghijklmn"
  
  print(iterrepl(alphabet))
  </code></pre>
  
  <p>The final result, however, is <code>None</code>, whereas I was hoping for <code>FIRST VOWELbcdSECOND VOWELfghTHIRD VOWELjklmn</code>. When I add a <code>print</code> statement before calling <code>iterrepl</code> within the function, I can see that the result of the last but one recursion is the desired one:</p>
  
  <pre><code>FIRST VOWELbcdefghijklmn
  FIRST VOWELbcdSECOND VOWELfghijklmn
  FIRST VOWELbcdSECOND VOWELfghTHIRD VOWELjklmn
  None
  </code></pre>
  
  <p>I cannot figure out what is wrong with the end of the recursion and would appreciate any advice!</p>