#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)\b(?<!@)\d(?:\s*\d){5}\b(?!@)"
Local $sString = "209 016 - should be come up in search result and as 400013(space removed)" & @CRLF & _
"" & @CRLF & _
"209016 - should also come up in search and unaltered as 209016" & @CRLF & _
"" & @CRLF & _
"any numeric string more then 6 digits long should not come up in search eg 20901677,209016@223123, 29016," & @CRLF & _
"" & @CRLF & _
""
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