fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String inp = "Welcome!\n"
  11. +" Welcome to the Apache ActiveMQ Console of localhost (ID:InternetXXX022-45298-5447895412354475-2:9) \n"
  12. +" You can find more information about Apache ActiveMQ on the Apache ActiveMQ Site \n"
  13. +" Broker\n"
  14. +" Name localhost\n"
  15. +" Version 5.13.3\n"
  16. +" ID ID:InternetXXX022-45298-5447895412354475-2:9\n"
  17. +" Uptime 14 days 14 hours\n"
  18. +" Store percent used 19\n"
  19. +" Memory percent used 0\n"
  20. +" Temp percent used 0\n"
  21. + "Queue Views\n"
  22. + "Graph\n"
  23. + "Topic Views\n"
  24. + " \n"
  25. + "Subscribers Views\n";
  26. Pattern rgx = Pattern.compile("(?<=Broker)\\R((?:.*\\R){1,7})");
  27. Matcher mtch = rgx.matcher(inp);
  28. if (mtch.find()) {
  29. String result = mtch.group();
  30. System.out.println(result.trim());
  31. }
  32. }
  33. }
Success #stdin #stdout 0.1s 27708KB
stdin
Standard input is empty
stdout
Name localhost
 Version  5.13.3
 ID   ID:InternetXXX022-45298-5447895412354475-2:9
 Uptime   14 days 14 hours
 Store percent used   19
 Memory percent used  0
 Temp percent used    0