fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.lang.*;
  4.  
  5. import java.util.regex.Matcher;
  6. import java.util.regex.Pattern;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. final String regex = "(?<=//)\\d+:\\d+:\\w+(?=(/|$))";
  14. final Pattern pattern = Pattern.compile(regex);
  15.  
  16. final Matcher matcher = pattern.matcher("//16642:4497:F2000018D562F2A412B4/");
  17.  
  18. final String subMatch;
  19. if (matcher.find()) {
  20. subMatch = matcher.group();
  21. } else {
  22. subMatch = null;
  23. }
  24.  
  25. System.out.println(subMatch);
  26. }
  27. }
Success #stdin #stdout 0.07s 33920KB
stdin
Standard input is empty
stdout
16642:4497:F2000018D562F2A412B4