#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?P<prod>\w+)-(?P<maj>\d).(?P<min>\d).(?P<bug>\d)(?:-(?P<pre>alpha|beta|rc)(?:\.(?P<pre_n>\d))?(?:\.(?P<pre_x>\w+))?(?<!centos|redhat))?(?:\.(?P<os>centos|redhat))?(?:\.(?P<plat>snb|ivb))?$"
Local $sString = "foo-1.2.3" & @CRLF & _
"foo-2.3.4-alpha" & @CRLF & _
"foo-3.4.5-rc.2" & @CRLF & _
"foo-4.5.6-rc.2.extra" & @CRLF & _
"withos-5.6.7.centos" & @CRLF & _
"osandextra-7.8.9-rc.foo.redhat" & @CRLF & _
"os_and_plat-4.4.4-rc.1.foo.centos.ivb" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"issue-0.1.0-beta.redhat.snb" & @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