$re = '/Browser((?:_type)?\s\"*)(?P<UA>(.+\"-|[^\"]+))/';
$str = '7 06:51:56 netscaler02 12/07/2017:12:51:56 GMT netscaler02 0-PPE-0 : AAA LOGIN_FAILED -807443279 0 : User slwagner - Client_ip 173.172.124.235 - Failure_reason "External authentication server denied access" - Browser Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3
7 06:51:56 netscaler02 12/07/2017:12:51:56 GMT netscaler02 0-PPE-0 : AAA LOGIN_FAILED -807443279 0 : User slwagner - Client_ip 173.172.124.235 - Failure_reason "External authentication server denied access" - Browser "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3"--asfashfi
';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 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