#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?=(?:[^\n\d]*\d){5})(?!(?:[^\n\d]*\d){21})(?:\(\+\d+\)|\+\d+) ?\d+(?:-\d+)*$"
Local $sString = "(+355)250235" & @CRLF & _
"+91 123456789012" & @CRLF & _
"(+355) 250-236-236-789" & @CRLF & _
"(+355) 2502-3656-1236-8789" & @CRLF & _
"+920123456789012345987" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"(+355)2" & @CRLF & _
"+91" & @CRLF & _
"(+355) 2" & @CRLF & _
"+920123456789012345987"
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