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