fork(2) download
  1.  
  2. import java.util.*;
  3. import java.lang.*;
  4. import java.io.*;
  5. import java.util.regex.*;
  6.  
  7. class Ideone
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. String re = "[^\\d\\s.]+|(?<!\\d\\.\\d)\\.";
  12. System.out.println("asdsad 59 asdf 2 asdf 56 89 .a 2.4 wef 95 asdf.".replaceAll(re, ""));
  13. System.out.println("asdsad 59 asdf .2 asdf 56 89 .a 2.4 wef 95 asdf.".replaceAll(re, ""));
  14.  
  15.  
  16. }
  17. }
Success #stdin #stdout 0.05s 711168KB
stdin
Standard input is empty
stdout
 59  2  56 89  24  95 
 59  2  56 89  24  95