fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.Matcher;
  5. import java.util.regex.Pattern;
  6.  
  7. class Ideone
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. final String regex = "(?U)^\\p{L}\\w{2,23}\\p{Alnum}$";
  12. final String string = "_notthis\n"
  13. + "nothis_\n"
  14. + "yes_123";
  15.  
  16. final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
  17. final Matcher matcher = pattern.matcher(string);
  18.  
  19. while (matcher.find()) {
  20. System.out.println(matcher.group(0));
  21. }
  22. }
  23. }
Success #stdin #stdout 0.1s 48372KB
stdin
Standard input is empty
stdout
yes_123