title: Python Regular Expression for validate numbers
body: <p>I want to create a regular expression for python snippet.</p>
  
  <pre><code>import re
  pattern = "\d*\.?\d+[Ee]?[+-]?\d*"
  r = re.compile(pattern)
  txt = """
  12
  .12
  12.5
  12.5E4
  12.5e4
  12.4E+4
  12E4
  12e-4
  """
  x = r.findall(txt)
  print(x)
  </code></pre>
  
  <p>for filtering all valid input from txt this code is fine
  but invalid input such as </p>
  
  <blockquote>
    <p>.12e, 12.3+4</p>
  </blockquote>
  
  <p>are also allowed how can I fix this?</p>