#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(([0-9A-Fa-f]{1,4}:){7})([0-9A-Fa-f]{1,4})$|(([0-9A-Fa-f]{1,4}:){1,6}:)(([0-9A-Fa-f]{1,4}:){0,4})([0-9A-Fa-f]{1,4})$"
Local $sString = "fe80::21d8:f50:c295:c4be" & @CRLF & _
"2001:cdba:0000:0000:0000:0000:3257:9652" & @CRLF & _
"2001:cdba:0:0:0:0:3257:9652" & @CRLF & _
"2001:cdba::3257:9652" & @CRLF & _
"2001:cdba::1222" & @CRLF & _
"1200:0000:AB00:1234:0000:2552:7777:1313:afed" & @CRLF & _
"21DA:D3:0:2F3B:2AA:FF:FE28:9C5A" & @CRLF & _
"2001:cdba::1:2:3:3257:9652" & @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