title: How to use regex with optional characters in python?
body: <p>Say I have a string</p>
  
  <pre><code>"3434.35353"
  </code></pre>
  
  <p>and another string</p>
  
  <pre><code>"3593"
  </code></pre>
  
  <p>How do I make a single regular expression that is able to match both without me having to set the pattern to something else if the other fails? I know <code>\d+</code> would match the <code>3593</code>, but it would not do anything for the <code>3434.35353</code>, but (<code>\d+\.\d+</code>) would only match the one with the decimal and return no matches found for the <code>3593</code>. </p>
  
  <p>I expect <code>m.group(1)</code> to return:</p>
  
  <pre><code>"3434.35353"
  </code></pre>
  
  <p>or</p>
  
  <pre><code>"3593"
  </code></pre>