#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mx)^(main|development|master|(features|tests|(bug|hot)fix)(\/[a-zA-Z0-9]+([-_][a-zA-Z0-9]+)*){1,2}|release\/[0-9]+(\.[0-9]+)*(-(alpha|beta|rc)[0-9]*)?)$"
Local $sString = "development" & @CRLF & _
"main" & @CRLF & _
"bugfix/user-list" & @CRLF & _
"bugfix/user_list" & @CRLF & _
"bugfix/123" & @CRLF & _
"bugfix/123/account-update" & @CRLF & _
"bugfix/123/account_update" & @CRLF & _
"bugfix/User_crud/account-update" & @CRLF & _
"bugfix/User_crud/account_update" & @CRLF & _
"tests/api" & @CRLF & _
"tests/123" & @CRLF & _
"tests/123/hello" & @CRLF & _
"release/1.0.1" & @CRLF & _
"release/1.0.1-beta1" & @CRLF & _
"release/1.0.1-beta" & @CRLF & _
"release/1.0.1-rc3" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"it should not match following" & @CRLF & _
"bugfix/" & @CRLF & _
"bugfix/-" & @CRLF & _
"bugfix/_" & @CRLF & _
"bugfix/-name" & @CRLF & _
"bugfix/_name" & @CRLF & _
"bugfix/-/name" & @CRLF & _
"bugfix/-/-" & @CRLF & _
"bugfix/-/_" & @CRLF & _
"release/v1.0.1"
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