#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(ABC)_([0-9]{4})_([0-9]+\.[0-9]+\.[0-9]+)(_[a-zA-Z])?(_[a-zA-Z]+)?\.xyz$"
Local $sString = "ABC_0000_0.0.0.xyz" & @CRLF & _
"Group 1 : ABC" & @CRLF & _
"Group 2 : 0000" & @CRLF & _
"Group 3 : 0.0.0" & @CRLF & _
"Group 4 : <empty>" & @CRLF & _
"Group 5 : <empty>" & @CRLF & _
"ABC_0001_0.1.0_N.xyz" & @CRLF & _
"Group 1 : ABC" & @CRLF & _
"Group 2 : 0001" & @CRLF & _
"Group 3 : 0.1.0" & @CRLF & _
"Group 4 : _N" & @CRLF & _
"Group 5 : <empty>" & @CRLF & _
"" & @CRLF & _
"ABC_0002_1.1.2_foo.xyz" & @CRLF & _
"Group 1 : ABC" & @CRLF & _
"Group 2 : 0002" & @CRLF & _
"Group 3 : 1.1.2" & @CRLF & _
"Group 4 : <empty>" & @CRLF & _
"Group 5 : _foo" & @CRLF & _
"" & @CRLF & _
"ABC_0002_42.42.42_N_bar.xyz" & @CRLF & _
"Group 1 : ABC" & @CRLF & _
"Group 2 : 0002" & @CRLF & _
"Group 3 : 42.42.42" & @CRLF & _
"Group 4 : _N" & @CRLF & _
"Group 5 : _bar"
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