fork download
  1. import java.util.regex.Matcher;
  2. import java.util.regex.Pattern;
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. class Ideone
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. Pattern pattern = Pattern.compile("^(\\P{L}+)\\p{L}");
  12. Matcher matcher = pattern.matcher("1234x");
  13. if (matcher.find()) {
  14. System.out.println(matcher.group(1));
  15. }
  16. }
  17. }
Success #stdin #stdout 0.06s 33580KB
stdin
Standard input is empty
stdout
1234