title: How to extract doubles or integers from a string java
body: <p>Im writing this code in which the user enters a string which contains numbers, e.g.</p>
  
  <pre><code>H3.07LLo my nam3 is bob12
  </code></pre>
  
  <p>And the output should be</p>
  
  <pre><code>3.07, 3.0, 12.0
  </code></pre>
  
  <p>I've managed to get a regular expression to look for doubles, but I don't know how to look for ints. this is my regex:</p>
  
  <pre><code>(-)?(([^\\d])(0)|[1-9][0-9]*)(.)([0-9]+)
  </code></pre>
  
  <p>I'm pretty new to regex. I tried adding <code>|[0-9]|</code> but I keep on messing it up wherever I put it in my current regex</p>