#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mx)^(" & @CRLF & _
" ((?:22[0-3]|2([0-1])?\d?|([1-9][0-9]?|1[0-9]{2}))\.) # a group, 1-223 with "."" & @CRLF & _
" ((?:25[0-5]|2[0-4]\d|[01]?(\d{0,2}))\.){2} # b and c groups 0-255 with "."" & @CRLF & _
"((25[0-5]|2[0-4]\d|[01]?(\d{0,2})) # d group, ends with optional netmask instead of "." // i tried making this non-optional as a group to solve my problem." & @CRLF & _
"(\/([89]|[12]\d|3[0-2]))?) # netmask" & @CRLF & _
",?\h?){1,50}$ # allow comma separated, optional space between, up to 50 IPs"
Local $sString = "1.1.1." & @CRLF & _
"1.1.1.2" & @CRLF & _
"1.1.1.2/23" & @CRLF & _
"1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23,1.1.1.2/23"
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