#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?sxX)#IPv4" & @CRLF & _
"(?<IPv4>" & @CRLF & _
" (?!0+\.)" & @CRLF & _
" (?<byte>2(?:[0-4]\d|5[0-5])|1?\d{1,2})" & @CRLF & _
" (?:\.(?&byte)){3}" & @CRLF & _
")" & @CRLF & _
"" & @CRLF & _
"#IPv6 from http://vernon.mauery.com/content/projects/linux/ipv6_regex" & @CRLF & _
"| (?<smb>[0-9a-f]{1,4}:){1,1} (?<sme>:[0-9a-f]{1,4}){1,6}" & @CRLF & _
"| (?&smb){1,2} (?&sme){1,5}" & @CRLF & _
"| (?&smb){1,3} (?&sme){1,4}" & @CRLF & _
"| (?&smb){1,4} (?&sme){1,3}" & @CRLF & _
"| (?&smb){1,5} (?&sme){1,2}" & @CRLF & _
"| (?&smb){1,6} (?&sme){1,1}" & @CRLF & _
"| ((?&smb){1,7}|:):" & @CRLF & _
"| :(?&sme){1,7}" & @CRLF & _
"| (?&smb){6} (?&IPv4)" & @CRLF & _
"| (?&smb){5} :?+ [0-9a-f]{1,4} :(?&IPv4)" & @CRLF & _
"| (?&smb){1,1} (?&sme){1,4} :(?&IPv4)" & @CRLF & _
"| (?&smb){1,2} (?&sme){1,3} :(?&IPv4)" & @CRLF & _
"| (?&smb){1,3} (?&sme){1,2} :(?&IPv4)" & @CRLF & _
"| (?&smb){1,4} (?&sme){1,1} :(?&IPv4)" & @CRLF & _
"| ((?&smb){1,5}|:) :(?&IPv4)" & @CRLF & _
"| :(?&sme){1,5} :(?&IPv4)" & @CRLF & _
""
Local $sString = "Valid" & @CRLF & _
"192.168.1.1" & @CRLF & _
"192.168.255.255" & @CRLF & _
"" & @CRLF & _
"Invalid" & @CRLF & _
"0.0.0.0" & @CRLF & _
"0.0.0.1" & @CRLF & _
"0.0.0.255" & @CRLF & _
"1.0.0.255" & @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