$re = '/(?i),([^,]*),([^,]*),"ViewerURL"/';
$str = '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
"FirstScreenshotTime","SessionId","ClientName","ServerName","DomainName","LoginName","UserName","ApplicationName","WindowTitle","ScreenshotID","Command","OS","ViewerURL"
';
preg_match($re, $str, $matches, PREG_OFFSET_CAPTURE, 0);
// Print the entire match result
var_dump($matches);
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 PHP, please visit: http://php.net/manual/en/ref.pcre.php