Java String replaceAll regex to remove everything except digits, dots and spaces
<p>I've browsed a lot of regex topics but none of these lead me to success in my particular situation.</p>

<p>(Using java) I have some charsequence which I then convert to array and extract numbers to array of doubles.</p>

<blockquote>
  <p>asdsad 59 asdf .2 asdf 56 89 .a 2.4 wef 95 asdf.</p>
</blockquote>

<p>then I want to use regex to remove the extra part and compose the following string</p>

<blockquote>
  <p>59 2 56 89 2.4 95</p>
</blockquote>

<p>so then I could just use <code>.split(" ")</code> and put them all to an array of doubles.</p>

<p>Until this moment I used the following expression</p>

<pre><code>[^0-9.\s]
</code></pre>

<p>but it leaves the extra dots and therefore not reliable. Now I'm trying something like</p>

<pre><code>[^0-9.\s]|([^0-9]\.[^0-9])
</code></pre>

<p>but it's not working at all, I'm not really good with regex, so could you explain me why the last expression is not working and how to fix it.</p>