fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.regex.*;
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. String str = "<13>Jan 09 12:33:50 TESTSRV1 AgentDevice=WindowsLog AgentLogFile=Security PluginVersion=7.2.4.86 Source=Microsoft-Windows-Security-Auditing Computer=corp.devnet.com OriginatingComputer=TESTSRV1 User= Domain= EventID=4755 EventIDCode=4755 EventType=8 EventCategory=13826 RecordNumber=1244048130 TimeGenerated=1483983229 TimeWritten=1483983229 Level=0 Keywords=0 Task=0 Opcode=0 Message=A security-enabled universal group was changed. Subject: Security ID: CORP\\TESTUSR1 Account Name: TESTUSR1 Account Domain: CORP Logon ID: 0x220f7a57 Group: Security ID: CORP\\Virtual Users Group Name: VirtualUsers Group Domain: CORP Changed Attributes: SAM Account Name: - SID History: - Additional Information: Privileges: -";
  13. Pattern ptrn = Pattern.compile("Group:\\s+Security\\s+ID:\\s+[^\\\\]*\\\\(.+?)\\s+(?:Account|Group)\\s+Name:");
  14. Matcher matcher = ptrn.matcher(str);
  15. while (matcher.find()) {
  16. System.out.println(matcher.group(1));
  17. }
  18. }
  19. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
Virtual Users