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.  
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. String regex = "\\bWARN\\h+.*(?:\\R(?!\\[C]).*)*";
  13. String string = "[C] L1250 WARN k2 bw34 Flex - Sockets:<16>, ThreadsPerCore:<1>\n"
  14. + "[C] L1250 WARN For abcd (analytical and transactional workloads). For 12s Systems and above, should be\n"
  15. + " disabled.\n"
  16. + "[C] L1250 INFO For abcd (analytical workloads), Hyperthreading should be enabled , 8s, 12s, 14d, 34t\n"
  17. + " d above.\n"
  18. + "[C] L1250 WARN Intel's Hyperthreading on 18+ Socket system disabled. Should be disabled urgently\n"
  19. + " fix it!\n"
  20. + "[C] L1300 OK CPU governors set as recommended\n"
  21. + "[C] L1250 WARN Intel's Hyperthreading on 8+ Socket system disabled.";
  22.  
  23. Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
  24. Matcher matcher = pattern.matcher(string);
  25.  
  26. while (matcher.find()) {
  27. System.out.println(matcher.group(0));
  28. }
  29. }
  30. }
Success #stdin #stdout 0.08s 33596KB
stdin
Standard input is empty
stdout
WARN  k2 bw34 Flex - Sockets:<16>, ThreadsPerCore:<1>
WARN  For abcd (analytical and transactional workloads). For 12s Systems and above, should be
                disabled.
WARN  Intel's Hyperthreading on 18+ Socket system disabled. Should be disabled urgently
                fix it!
WARN  Intel's Hyperthreading on 8+ Socket system disabled.