title: Python Replace an Undetermined length of Text
body: <p>I have a string like this:</p>
  
  <pre><code>Hi. My name is _John_. I am _20_ years old.
  </code></pre>
  
  <p>and I'd like to convert it into this:</p>
  
  <pre><code>Hi. My name is &lt;b&gt;John&lt;/b&gt;. I am &lt;b&gt;20&lt;/b&gt; years old.
  </code></pre>
  
  <p>I did something like this but no luck.</p>
  
  <pre><code>import re
  text = "Hi. My name is _John_. I am _20_ years old."
  pattern = "(.*)(\_)(.*)(\_)(.*)"
  re.sub(pattern, r'\1&lt;b&gt;\3&lt;/b&gt;\5', text)
  'Hi. My name is _John_. I am &lt;b&gt;20&lt;/b&gt; years old.'
  </code></pre>
  
  <p>What is wrong with the pattern? Why is it not seeing the first bold text?</p>
  
  <p>Any help would be appreciated.
  Thanks.</p>