#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?sm)^0(?:(?!^0).)*?(?:kryptonite|stalagmite)"
Local $sString = "00:20314 lorem ipsum" & @CRLF & _
" want this" & @CRLF & _
" kryptonite" & @CRLF & _
"" & @CRLF & _
"00:02314 quux" & @CRLF & _
" padding" & @CRLF & _
" dont want this" & @CRLF & _
"" & @CRLF & _
"00:03124 foo" & @CRLF & _
" neither this" & @CRLF & _
"" & @CRLF & _
"00:01324 foo" & @CRLF & _
" but we want this" & @CRLF & _
" stalagmite" & @CRLF & _
"" & @CRLF & _
"00:02134 tralala" & @CRLF & _
" not this" & @CRLF & _
"" & @CRLF & _
"00:03124 bar foo" & @CRLF & _
" and we want this" & @CRLF & _
" kryptonite but not this(!)" & @CRLF & _
"" & @CRLF & _
"00:02134 foo bar" & @CRLF & _
" and not this either" & @CRLF & _
"" & @CRLF & _
"00:01234 dolor sit amet" & @CRLF & _
" EOF"
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