#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(\-[a-zA-Z]{1,50})?)"
Local $sString = "Should match" & @CRLF & _
"0.0.0" & @CRLF & _
"0.0.0-a" & @CRLF & _
"1.5.89-lorem" & @CRLF & _
"6.12.5-iPsUm" & @CRLF & _
"" & @CRLF & _
"Mustn't match (even partially)" & @CRLF & _
"a.2.3 -> 'a' is not a number" & @CRLF & _
"1.5.89:lorem -> only '-' is valid to separate version and letters" & @CRLF & _
"1.2.3-4 -> '4' is not letter(s)" & @CRLF & _
"5.6.8.9 -> '9' is not letters and '.' used instead of '-'" & @CRLF & _
"8.k.2-j -> 'k' is not a number" & @CRLF & _
"7895.5.8 -> '7895' is 4 digit long, 3 is the max" & @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