fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String inputLine = "What is the weather in 75042?";
  11. Pattern pattern = Pattern.compile("weather\\D*(\\d+)");
  12. Matcher matcher = pattern.matcher(inputLine);
  13.  
  14. if (matcher.find()) {
  15. System.out.println(matcher.group(1));
  16. }
  17.  
  18. }
  19. }
Success #stdin #stdout 0.1s 27900KB
stdin
Standard input is empty
stdout
75042