#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^@\d.*distribute_event: message EventRinging(?:\R(?!\d).*)*\R.*RTargetObjectSelected'\h+'\?VAG_EMERGENCIA2.*"
Local $sString = "@20:20:51.8200 [0] 8.1.104.23 distribute_event: message EventRinging" & @CRLF & _
" AttributeUserData [634] 00 18 00 00.." & @CRLF & _
" 'RTargetObjectSelected' '?VAG_EMERGENCIA2:'" & @CRLF & _
"20:20:53.821: $+SIP:CTI:HA_SEND_SYNC_MESSAGE:39982499:0" & @CRLF & _
"20:20:54.821: $+SIP:CTI:HA_SEND_SYNC_MESSAGE:39982499:0" & @CRLF & _
"20:20:54.821 Int 04544 Interaction message "EventRinging" generated" & @CRLF & _
"@20:21:51.8200 [0] 8.1.104.23 distribute_event: message EventRinging" & @CRLF & _
" AttributeUserData [634] 00 18 00 00.." & @CRLF & _
" 'RTargetObjectSelected' '?VAG_EMERGENCIA1:'" & @CRLF & _
"20:20:54.821 Int 04544 Interaction message "EventRinging" generated" & @CRLF & _
"@20:21:51.8200 [0] 8.1.104.23 distribute_event: message EventRinging" & @CRLF & _
" AttributeUserData [634] 00 18 00 00.." & @CRLF & _
" 'RTargetObjectSelected' '?VAG_AGENCIA1:'" & @CRLF & _
"20:20:54.821 Int 04544 Interaction message "EventRinging" generated" & @CRLF & _
"20:23:51.821: $+SIP:CTI:HA_SEND_SYNC_MESSAGE:39982499:0" & @CRLF & _
"20:24:51.821: $+SIP:CTI:HA_SEND_SYNC_MESSAGE:39982499:0" & @CRLF & _
"@20:25:51.8200 [0] 8.1.104.23 distribute_event: message EventRinging" & @CRLF & _
" AttributeUserData [634] 00 18 00 00.." & @CRLF & _
" 'RTargetObjectSelected' '?VAG_EMERGENCIA1:'" & @CRLF & _
"20:20:54.821 Int 04544 Interaction message "EventRinging" generated " & @CRLF & _
"20:28:51.821: $+SIP:CTI:HA_SEND_SYNC_MESSAGE:39982499:0" & @CRLF & _
"@20:29:51.8200 [0] 8.1.104.23 distribute_event: message EventNotRinging" & @CRLF & _
" AttributeUserData [634] 00 18 00 00.." & @CRLF & _
" 'RTargetObjectSelected' '?VAG_EMERGENCIA2:'" & @CRLF & _
"20:20:54.821 Int 04544 Interaction message "EventNotRinging" generated" & @CRLF & _
"20:30:51.821: $+SIP:CTI:HA_SEND_SYNC_MESSAGE:39982499:0" & @CRLF & _
"20:31:51.821: $+SIP:CTI:HA_SEND_SYNC_MESSAGE:39982499:0" & @CRLF & _
"20:32:51.821: $+SIP:CTI:HA_SEND_SYNC_MESSAGE:39982499:0" & @CRLF & _
"@20:33:51.8200 [0] 8.1.104.23 distribute_event: message EventRinging" & @CRLF & _
" AttributeUserData [634] 00 18 00 00.." & @CRLF & _
" 'RTargetObjectSelected' '?VAG_EMERGENCIA2:'" & @CRLF & _
"20:20:54.821 Int 04544 Interaction message "EventRinging" generated" & @CRLF & _
"20:34:51.821: $+SIP:CTI:HA_SEND_SYNC_MESSAGE:39982499:0" & @CRLF & _
"20:35:51.821: $+SIP:CTI:HA_SEND_SYNC_MESSAGE:39982499:0" & @CRLF & _
"20:36:51.821: $+SIP:CTI:HA_SEND_SYNC_MESSAGE:39982499:0" & @CRLF & _
"@20:37:51.8200 [0] 8.1.104.23 distribute_event: message EventNotRinging" & @CRLF & _
" AttributeUserData [634] 00 18 00 00.." & @CRLF & _
" 'RTargetObjectSelected' '?VAG_EMERGENCIA1:'" & @CRLF & _
"20:20:54.821 Int 04544 Interaction message "EventRinging" generated" & @CRLF & _
"20:38:51.821: $+SIP:CTI:HA_SEND_SYNC_MESSAGE:39982499:0" & @CRLF & _
"20:39:51.821: $+SIP:CTI:HA_SEND_SYNC_MESSAGE:39982499:0" & @CRLF & _
"@20:40:51.8200 [0] 8.1.104.23 distribute_event: message EventRinging" & @CRLF & _
" AttributeUserData [634] 00 18 00 00.." & @CRLF & _
" 'RTargetObjectSelected' '?VAG_EMERGENCIA2:'" & @CRLF & _
"20:20:54.821 Int 04544 Interaction message "EventNotRinging" generated" & @CRLF & _
"20:41:51.821: $+SIP:CTI:HA_SEND_SYNC_MESSAGE:39982499:0" & @CRLF & _
"@20:42:51.8200 [0] 8.1.104.23 distribute_event: message EventNotRinging" & @CRLF & _
" AttributeUserData [634] 00 18 00 00.." & @CRLF & _
" 'RTargetObjectSelected' '?VAG_EMERGENCIA1:'" & @CRLF & _
"20:20:54.821 Int 04544 Interaction message "EventNotRinging" generated" & @CRLF & _
"20:42:51.821: $+SIP:CTI:HA_SEND_SYNC_MESSAGE:39982499:0"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; 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