$re = '/^.*?(?=\=)=\s"(?P<Severity>.*?(?=\"))".*?(?=Gauge32).*?(?=:):\s(?P<EventCount>\d+).*?(?=AlarmOriginEntity).*?(?=\:):\s+"(?P<OriginEntity>.*?(?=\"))".*?(?=\")"(?P<OriginHost>.*?(?=\"))".*?(?=\")"(?P<ImpactedHost>.*?(?=\"))".*?(?=\")"(?P<ImpactedApp>.*?(?=\"))".*?(?=\")"(?P<VendorMessageID>.*?(?=\"))".*?(?=\")"(?P<MPERuleName>.*?(?=\"))".*?(?=\")"(?P<EventDirection>.*?(?=\"))".*?(?=\")"(?P<OriginZone>.*?(?=\"))".*?(?=\")"(?P<ImpactedZone>.*?(?=\"))".*?(?=\")"(?P<ImpactedEntity>.*?(?=\"))".*?(?=\")"(?P<OriginLocation>.*?(?=\"))".*?(?=\")"(?P<ImpactedLocation>.*?(?=\"))".*?(?=\")"(?P<OriginNetwork>.*?(?=\"))".*?(?=\")"(?P<ImpactedNetwork>.*?(?=\"))".*?(?=\")"(?P<OriginPort>.*?(?=\"))".*?(?=\")"(?P<ImpactedPort>.*?(?=\"))".*?(?=\")"(?P<AlarmProtocol>.*?(?=\"))".*?(?=\")"(?P<OriginUser>.*?(?=\"))".*?(?=\")"(?P<ImpactedUser>.*?(?=\"))".*?(?=\")"(?P<AlarmObject>.*?(?=\"))".*?(?=\")"(?P<AlarmSender>.*?(?=\"))".*?(?=\")"(?P<AlarmRecipient>.*?(?=\"))".*?(?=\")"(?P<AlarmSubject>.*?(?=\"))".*?(?=\")"(?P<AlarmGroup>.*?(?=\"))".*?(?=\")"(?P<AlarmDomain>.*?(?=\"))".*?(?=\")"(?P<AlarmSession>.*?(?=\"))".*?(?=\")"(?P<AlarmProcessName>.*?(?=\"))".*?(?=\")"(?P<AlarmURL>.*?(?=\"))".*?(?=\")"(?P<BytesIn>.*?(?=\"))".*?(?=\")"(?P<BytesOut>.*?(?=\"))".*?(?=\")"(?P<ItemsIn>.*?(?=\"))".*?(?=\")"(?P<ItemsOut>.*?(?=\"))".*?(?=\")"(?P<Duration>.*?(?=\"))".*?(?=\")"(?P<Amount>.*?(?=\"))".*?(?=\")"(?P<Quantity>.*?(?=\"))".*?(?=\")"(?P<Rate>.*?(?=\"))".*?(?=\")"(?P<Size>.*?(?=\"))".*?(?=v\=)(?P<Message>.*?(?=\<\/aie\>)).*?(?=\=)=\s"(?P<KBWebRefernce>.*?(?=\"))".*?(?=\")"(?P<OriginMACAddress>.*?(?=\"))".*?(?=\")"(?P<ImpactedMACAddress>.*?(?=\"))".*?(?=\")"(?P<OriginNATIPAddress>.*?(?=\"))".*?(?=\")"(?P<ImpactedNATIPAddress>.*?(?=\"))".*?(?=\")"(?P<OriginInterface>.*?(?=\"))".*?(?=\")"(?P<ImpactedInterface>.*?(?=\"))".*?(?=\")"(?P<AlarmPID>.*?(?=\"))".*?(?=\")"(?P<AlarmVersion>.*?(?=\"))".*?(?=\")"(?P<AlarmCommand>.*?(?=\"))".*?(?=\")"(?P<AlarmObjectName>.*?(?=\"))".*?(?=\")"(?P<OriginNATPORT>.*?(?=\"))".*?(?=\")"(?P<ImpactedNATPort>.*?(?=\"))"/';
$str = '#011LOGRHYTHM-ARM-MIB::armAlarmSeverity = ""#011LOGRHYTHM-ARM-MIB::armAlarmEventDateMin = STRING: "6/22/2016 1:39:14 PM"#011LOGRHYTHM-ARM-MIB::armAlarmEventDateMax = STRING: "6/22/2016 1:39:14 PM"#011LOGRHYTHM-ARM-MIB::armAlarmEventCount = Gauge32: 1#011LOGRHYTHM-ARM-MIB::armAlarmOriginEntity = STRING: "Global Entity"#011LOGRHYTHM-ARM-MIB::armAlarmOriginHost = STRING: "10.10.129.74"#011LOGRHYTHM-ARM-MIB::armAlarmImpactedHost = STRING: "216.58.216.238"#011LOGRHYTHM-ARM-MIB::armAlarmImpactedApplication = ""#011LOGRHYTHM-ARM-MIB::armAlarmVendorMessageID = ""#011LOGRHYTHM-ARM-MIB::armAlarmMPERuleName = ""#011LOGRHYTHM-ARM-MIB::armAlarmEventDirection = STRING: "Unknown"#011LOGRHYTHM-ARM-MIB::armAlarmOriginZone = STRING: "Internal"#011LOGRHYTHM-ARM-MIB::armAlarmImpactedZone = STRING: "External"#011LOGRHYTHM-ARM-MIB::armAlarmImpactedEntity = STRING: "Global Entity"#011LOGRHYTHM-ARM-MIB::armAlarmOriginLocation = ""#011LOGRHYTHM-ARM-MIB::armAlarmImpactedLocation = ""#011LOGRHYTHM-ARM-MIB::armAlarmOriginNetwork = ""#011LOGRHYTHM-ARM-MIB::armAlarmImpactedNetwork = ""#011LOGRHYTHM-ARM-MIB::armAlarmOriginPort = ""#011LOGRHYTHM-ARM-MIB::armAlarmImpactedPort = ""#011LOGRHYTHM-ARM-MIB::armArmAlarmProtocol = ""#011LOGRHYTHM-ARM-MIB::armAlarmLogin = ""#011LOGRHYTHM-ARM-MIB::armAlarmLogin = ""#011LOGRHYTHM-ARM-MIB::armAlarmObject = ""#011LOGRHYTHM-ARM-MIB::armAlarmSender = ""#011LOGRHYTHM-ARM-MIB::armAlarmRecipient = ""#011LOGRHYTHM-ARM-MIB::armAlarmSubject = ""#011LOGRHYTHM-ARM-MIB::armAlarmGroup = ""#011LOGRHYTHM-ARM-MIB::armAlarmDomain = ""#011LOGRHYTHM-ARM-MIB::armAlarmSession = ""#011LOGRHYTHM-ARM-MIB::armAlarmProcess = ""#011LOGRHYTHM-ARM-MIB::armAlarmURL = ""#011LOGRHYTHM-ARM-MIB::armAlarmBytesIn = ""#011LOGRHYTHM-ARM-MIB::armAlarmBytesOut = ""#011LOGRHYTHM-ARM-MIB::armAlarmItemsIn = ""#011LOGRHYTHM-ARM-MIB::armAlarmItemsOut = ""#011LOGRHYTHM-ARM-MIB::armAlarmDuration = ""#011LOGRHYTHM-ARM-MIB::armAlarmAmount = ""#011LOGRHYTHM-ARM-MIB::armAlarmQuantity = ""#011LOGRHYTHM-ARM-MIB::armAlarmRate = ""#011LOGRHYTHM-ARM-MIB::armAlarmSize = ""#011LOGRHYTHM-ARM-MIB::armAlarmLogs = STRING: "MSG: <aie v=\\"1\\"><_0 DIP=\\"216.58.216.238\\" NormalMsgDate=\\"2016-06-22 19:39:07\\" NormalMsgDateLower=\\"2016-06-22 19:39:07\\" NormalMsgDateUpper=\\"2016-06-22 19:39:08\\" RuleBlockType=\\"1\\" SIP=\\"10.10.129.74\\" /><_ AIERuleID=\\"550\\" DateEdited=\\"2015-10-15 19:52:11\\" /></aie>"#011LOGRHYTHM-ARM-MIB::armAlarmKBWebReference = ""#011LOGRHYTHM-ARM-MIB::armAlarmOriginMAC = ""#011LOGRHYTHM-ARM-MIB::armAlarmImpactedMAC = ""#011LOGRHYTHM-ARM-MIB::armAlarmOriginNATIP = ""#011LOGRHYTHM-ARM-MIB::armAlarmImpactedNATIP = ""#011LOGRHYTHM-ARM-MIB::armAlarmOriginInterface = ""#011LOGRHYTHM-ARM-MIB::armAlarmImpactedInterface = ""#011LOGRHYTHM-ARM-MIB::armAlarmPID = STRING: "0"#011LOGRHYTHM-ARM-MIB::armAlarmVersion = ""#011LOGRHYTHM-ARM-MIB::armAlarmCommand = ""#011LOGRHYTHM-ARM-MIB::armAlarmObjectName = ""#011LOGRHYTHM-ARM-MIB::armAlarmOriginNATPort = STRING: "0"#011LOGRHYTHM-ARM-MIB::armAlarmImpactedNATPort = STRING: "0"
';
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