fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.util.regex.*;
  4.  
  5. class Main
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. Pattern p = Pattern.compile("([A-Za-z]{2,5})-?[0-9]{1,15}[A-Za-z]{0,15}");
  10. Matcher m = p.matcher("abc123abc");
  11. if (m.find()) {
  12. System.out.println(m.group(1));
  13. }
  14. }
  15. }
Success #stdin #stdout 0.02s 245632KB
stdin
Standard input is empty
stdout
abc