#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(\n|\s)(?:(?:\+?(\d{1}|\d{2}|\d{3})\s*)\s*(?:\(\s*(\d{1}|\d{2}|\d{3})\s*\)|(\d{1,3}))\s*\-?(?:\(\s*(\d{1,3})\s*\)|(\d{3}))\s*\-?(?:\d{2}\s*\-?\d{2}))"
Local $sString = "" & @CRLF & _
"+79996364778 rus" & @CRLF & _
"8 (918) 373-6633 rus" & @CRLF & _
"+1 650-798-2800 usa " & @CRLF & _
" 8(949)373-66-55 rus" & @CRLF & _
" +7 (961) 859-56-19 rus" & @CRLF & _
"+1 205-635-1136 usa" & @CRLF & _
"+22(909)333 4334" & @CRLF & _
"+7(985)5310868" & @CRLF & _
"+79855310868" & @CRLF & _
"88008454545" & @CRLF & _
"+55 11 99999-5555 Brazil" & @CRLF & _
"+593 7 282-3889 Ecuador" & @CRLF & _
"(+44) 0848 9123 456 UK" & @CRLF & _
"+1 284 852 5500 BVI" & @CRLF & _
"" & @CRLF & _
"+1 345 9490088 Grand Cayman" & @CRLF & _
"+32 2 702-9200 Belgium" & @CRLF & _
"+65 6511 9266 Asia Pacific" & @CRLF & _
"+86 21 2230 1000 Shanghai" & @CRLF & _
"+9124 4723300 India" & @CRLF & _
"+821012345678 South Korea" & @CRLF & _
"And for your extension pleasure" & @CRLF & _
"+55 11 99999-5555 ramal 123 Brazil" & @CRLF & _
"+55 11 99999-5555 foo786544 Brazil" & @CRLF & _
"" & @CRLF & _
"(?!\b(0)\1+\b)(\+?\d{1,3})\s?\(?\d{3}\)?\s?([. -]?)\d{3}\3\d{4}"
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