$re = '/(-- iOS 8\.2 --)\G|.(?:iPhone 4s.\((.*?)\))/';
$str = '== Device Types ==
iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)
iPhone 5 (com.apple.CoreSimulator.SimDeviceType.iPhone-5)
iPhone 5s (com.apple.CoreSimulator.SimDeviceType.iPhone-5s)
iPhone 6 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus)
iPhone 6 (com.apple.CoreSimulator.SimDeviceType.iPhone-6)
iPad 2 (com.apple.CoreSimulator.SimDeviceType.iPad-2)
iPad Retina (com.apple.CoreSimulator.SimDeviceType.iPad-Retina)
iPad Air (com.apple.CoreSimulator.SimDeviceType.iPad-Air)
Resizable iPhone (com.apple.CoreSimulator.SimDeviceType.Resizable-iPhone)
Resizable iPad (com.apple.CoreSimulator.SimDeviceType.Resizable-iPad)
== Runtimes ==
iOS 8.1 (8.1 - 12B411) (com.apple.CoreSimulator.SimRuntime.iOS-8-1)
iOS 8.2 (8.2 - 12D508) (com.apple.CoreSimulator.SimRuntime.iOS-8-2)
== Devices ==
-- iOS 8.1 --
iPhone 4s (F05C1130-5F17-483C-8545-41DB60BD6729) (Shutdown)
-- iOS 8.2 --
iPhone 4s (F05C1130-5F17-483C-8545-41DB60BD6729) (Shutdown)
iPhone 5 (6A9974F3-4C46-4583-9D74-A1083E76CCB9) (Shutdown)
iPhone 5s (89547F56-69D0-4696-98F5-9C4AF58BEC08) (Shutdown)
iPhone 6 Plus (AD19FA1E-4091-44D7-900E-E9BDF6E22460) (Shutdown)
iPhone 6 (6D639171-D599-43E9-BFCF-CD2765CE4DEE) (Booted)
iPad 2 (C8A1DF07-27D9-467F-BBCC-C76695C81BD0) (Shutdown)
iPad Retina (3ED6ED7E-D173-4C50-88EB-AB2F1CCA30D0) (Shutdown)
iPad Air (9FF89D26-305F-4BBF-8BC6-90BB2AE4C424) (Shutdown)
Resizable iPhone (C4BC5922-316C-4176-96FE-8FE2B066C1FD) (Shutdown)
Resizable iPad (DCF07107-4FD4-4B77-A531-0B652F6C1C61) (Shutdown)
-- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-8-3 --
iPhone 4s (F88A4DF6-3B81-445D-A296-73CC69CE7FE6) (Shutdown) (unavailable, runtime profile not found)
iPhone 5 (ED535FC5-34CE-43B4-ABCA-C57093F7D8FF) (Shutdown) (unavailable, runtime profile not found)
iPhone 5s (7CFE4925-328E-483E-B137-996520446291) (Shutdown) (unavailable, runtime profile not found)
iPhone 6 Plus (1BAD21C1-33B8-49A1-90F1-6C9C4FDDDE4B) (Shutdown) (unavailable, runtime profile not found)
iPhone 6 (3EDA5D17-001B-49CD-83A6-7E1A3926CB28) (Shutdown) (unavailable, runtime profile not found)
iPad 2 (EA7BBF7B-CFA1-49A6-A84D-471F31E832B8) (Shutdown) (unavailable, runtime profile not found)
iPad Retina (52B69DBB-352A-49C9-9B56-8EEB463DD023) (Shutdown) (unavailable, runtime profile not found)
iPad Air (CF60978F-52EF-4E12-8B63-02BEA30D1702) (Shutdown) (unavailable, runtime profile not found)
Resizable iPhone (903870E3-FF55-48BB-953F-26CCBAFE5E45) (Shutdown) (unavailable, runtime profile not found)
Resizable iPad (C447F468-2FCE-4731-8CAA-86922F8002CC) (Shutdown) (unavailable, runtime profile not found)';
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