fork download
  1. /* package whatever; // don't place package name! */
  2. import java.util.regex.Matcher;
  3. import java.util.regex.Pattern;
  4. import java.util.*;
  5. import java.lang.*;
  6. import java.io.*;
  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 = "^- \\[[^]\\[]+]\\((https?://[^\\s()]+)\\).*\\R(Version:.*)\\R(Rating:.*)\\R(\\S.+)$";
  14. final String string = "- [ABC Advanced Anticheat](https://w...content-available-to-author-only...c.org/resources/91606/) - Removed due to private reasons \n"
  15. + "Version: 1.7 - 1.16 \n"
  16. + "Rating: 4 \n"
  17. + "Discontinued\n"
  18. + "- [AbdeslamNeverCheat](https://w...content-available-to-author-only...c.org/resources/61280) \n"
  19. + "Version: 1.8 \n"
  20. + "Rating: 1 \n"
  21. + "Discontinued";
  22.  
  23. final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
  24. final Matcher matcher = pattern.matcher(string);
  25.  
  26. while (matcher.find()) {
  27. System.out.println("Link: " + matcher.group(1));
  28. System.out.println("Version: " + matcher.group(2));
  29. System.out.println("Rating: " + matcher.group(3));
  30. System.out.println("Status: " + matcher.group(4));
  31. }
  32. }
  33. }
Success #stdin #stdout 0.1s 50620KB
stdin
Standard input is empty
stdout
Link: https://w...content-available-to-author-only...c.org/resources/91606/
Version: Version: 1.7 - 1.16  
Rating: Rating: 4  
Status: Discontinued
Link: https://w...content-available-to-author-only...c.org/resources/61280
Version: Version: 1.8  
Rating: Rating: 1  
Status: Discontinued