#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)\b(?:\d{6} \d{5}|[1-9]\d{4} \d{5}|[1-9]\d{9}|\d{11})\b"
Local $sString = "Pattern 1 - The length of this pattern is exactly 10 and cannot start with a zero. These consist of only integers. Ex: '1234567890'" & @CRLF & _
"" & @CRLF & _
"Pattern 2 - The length of this pattern is exactly 11 and can start with a zero. These consist of only integers. Ex: '01234567890'" & @CRLF & _
"" & @CRLF & _
"Pattern 3 - The length of this pattern is exactly 11 and cannot start with a zero. There is one space after the 5th number and all other characters are numbers. Ex: '12345 67890'" & @CRLF & _
"" & @CRLF & _
"Pattern 4 - The length of this pattern is exactly 12 and can start with a zero. There is one space after the 6th number and all other characters are numbers. Ex: '012345 67890'" & @CRLF & _
"" & @CRLF & _
"Note - The example pattern example provided is for representation only. The actual set of numbers in my string can be anything. Example: '2345653340' or '034945 85730' or '000000 00000' or '09876543210'."
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