fork download
  1. import java.util.regex.*;
  2.  
  3. class IdeOne {
  4.  
  5. public static void main(String[] args) {
  6. String s2 = "K000";
  7. String a2 = "";
  8. String n2 = "";
  9.  
  10. Pattern p2 = Pattern.compile("([A-Z]+)(.+)");
  11. Matcher m2 = p2.matcher(s2);
  12. if (m2.matches()) {
  13. a2 = m2.group(1);
  14. n2 = m2.group(2);
  15. }
  16.  
  17. System.out.println(a2);
  18. System.out.println(n2);
  19. }
  20. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
K
000