import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "(?i),([^,]*),([^,]*),\"ViewerURL\"";
final String string = "2015-10-07T08:59:28,42eba5da-2637-4df0-ad31-2b868a74fced,FMD4080N0W,HKGRANMC-06,xxx.xxx.com,lxxxxxx229,n/a,wfshell shell,ICA Seamless Host Agent,2c693e3b-087b-4ad5-9664-8647feb39989,,Windows,https://xxxxxx:4884/xxxxxx/SlideViewer.aspx?SessionID=42EBA5DA-2637-4DF0-AD31-2B868A74FCED&DisplayOnAir=false&lang=en&SSID=2C693E3B-087B-4AD5-9664-8647FEB39989\n\n"
+ "\"FirstScreenshotTime\",\"SessionId\",\"ClientName\",\"ServerName\",\"DomainName\",\"LoginName\",\"UserName\",\"ApplicationName\",\"WindowTitle\",\"ScreenshotID\",\"Command\",\"OS\",\"ViewerURL\"\n";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(string);
if (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html