#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(.+$)\RAnzahl:\h(\d+)\R?(?:\h+davon\R(?:\h+(\d+)\h(.+$)\R?))?"
Local $sString = "Installierte Busteilnehmer" & @CRLF & _
"Anzahl: 1723" & @CRLF & _
"automatische Melder" & @CRLF & _
"Anzahl: 1490 davon" & @CRLF & _
" 43 Thermodiff. Melder" & @CRLF & _
" 1447 O2T-Melder" & @CRLF & _
"nicht automatische Melder" & @CRLF & _
"Anzahl: 144" & @CRLF & _
"Koppler" & @CRLF & _
"Anzahl: 45 davon" & @CRLF & _
" 15 Funkkoppler (81 Funksockel)" & @CRLF & _
"Signalgeber" & @CRLF & _
"Anzahl: 857 davon" & @CRLF & _
" 8 Sprachalarmierung" & @CRLF & _
" 793 Sprachalarmierung integriert im Melder" & @CRLF & _
" 36 optisch/Sprache" & @CRLF & _
" 20 optisch/Sprache integriert im Melder"
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