fork(1) download
  1. import java.util.regex.*;
  2.  
  3. class Main
  4. {
  5. public static void main (String[] args) throws java.lang.Exception
  6. {
  7. String input = "Host is up (0.0020s latency).";
  8. Pattern pattern = Pattern.compile("\\d+\\.\\d+");
  9. Matcher matcher = pattern.matcher(input);
  10. if (matcher.find()) {
  11. System.out.println(matcher.group());
  12. }
  13. }
  14. }
Success #stdin #stdout 0.05s 213440KB
stdin
Standard input is empty
stdout
0.0020