fork download
  1. import java.util.*;
  2. import java.util.regex.*;
  3. import java.lang.*;
  4.  
  5. class Main
  6. {
  7. static final String[] data = new String[] {
  8. "This reverts commit c289f6fa1f8642a5caf728ef8ff87afd5718cd99.",
  9. "This reverts commit c7740a943ec896247ebc5514b6be02710caf3c53. There should",
  10. "This reverts 518920b764ee9150781e68217181b24d0712748e commit."
  11. };
  12. public static void main (String[] args) throws java.lang.Exception
  13. {
  14. Pattern p = Pattern.compile("\\p{Alnum}{40}");
  15. for (String s : data) {
  16. Matcher m = p.matcher(s);
  17. if (m.find()) {
  18. System.out.println(m.group());
  19. }
  20. }
  21. }
  22. }
Success #stdin #stdout 0.08s 380160KB
stdin
Standard input is empty
stdout
c289f6fa1f8642a5caf728ef8ff87afd5718cd99
c7740a943ec896247ebc5514b6be02710caf3c53
518920b764ee9150781e68217181b24d0712748e