#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)\d{4}(\d{3})\1"
Local $sString = "Note - I don't need spaces in between. Pattern 1: Number: 3527432432 Let's consider the above number as ABCD XYZ XYZ pattern" & @CRLF & _
"" & @CRLF & _
"Pattern 2: Number: 3527898989 ABCD XY XY XY" & @CRLF & _
"" & @CRLF & _
"Pattern 3: Number: 3535358745 XY XY XY ABCD" & @CRLF & _
"" & @CRLF & _
"Pattern 4: 5432888999 ABCD XXX YYY" & @CRLF & _
"" & @CRLF & _
"Pattern 5: 5432888899 ABCD XXXX YY" & @CRLF & _
"" & @CRLF & _
"Pattern 65432334422 ABCD XX YY ZZ"
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