$re = '/(?m)(?<Changed>^[^-]*$)/m';
$str = 'Changed Attributes:
SAM Account Name: -
Display Name: -
User Principal Name: -
Home Directory: -
Home Drive: -
Script Path: -
Profile Path: -
User Workstations: -
Password Last Set: -
Account Expires: -
Primary Group ID: -
AllowedToDelegateTo: -
Old UAC Value: 0x10
New UAC Value: 0x1DA11
User Account Control:
Account Disabled
\'Don\'t Expire Password\' - Enabled
\'Encrypted Text Password Allowed\' - Enabled
\'Smartcard Required\' - Enabled
\'Not Delegated\' - Enabled
\'Use DES Key Only\' - Enabled
\'Don\'t Require Preauth\' - Enabled
User Parameters: -
SID History: -
Logon Hours:';
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