#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?x)^(" & @CRLF & _
" ( # define some frequently used capture groups" & @CRLF & _
" (?!x)x # always false ("match only if there is no 'x' ahead and there is 'x' ahead")" & @CRLF & _
" (?<name>[^_]+) # group "name", name of the program/library" & @CRLF & _
" (?<os>windows|linux|osx|android) # group "os", operating systems" & @CRLF & _
" (?<arch>x86-64|x86|arm64|armhf|armel) # group"arch", architectures" & @CRLF & _
" (?<buildtype>release|debug) # group"buildtype", build types" & @CRLF & _
" (?<linking>shared|static|mixed) # group "linking", library linking/build types" & @CRLF & _
" )" & @CRLF & _
" |" & @CRLF & _
" ( # regular executable builds" & @CRLF & _
" (?!lib)\g<name>_build_\g<os>_\g<arch>_\g<buildtype>" & @CRLF & _
" )" & @CRLF & _
" |" & @CRLF & _
" ( # library builds" & @CRLF & _
" lib\g<name>_build_\g<os>_\g<arch>_\g<linking>_\g<buildtype>" & @CRLF & _
" )" & @CRLF & _
" |" & @CRLF & _
" ( # syncing source code of a project from git or something else" & @CRLF & _
" \g<name>_src" & @CRLF & _
" )" & @CRLF & _
" |" & @CRLF & _
" ( # static code analizer" & @CRLF & _
" \g<name>_analyze_(cppcheck|scan-build)" & @CRLF & _
" )" & @CRLF & _
" |" & @CRLF & _
" ( # package builds" & @CRLF & _
" \g<name>_pkg_\g<os>_" & @CRLF & _
" (" & @CRLF & _
" ((?<=linux_) # if there is "linux_" before here" & @CRLF & _
" # then match" & @CRLF & _
" (deb|rpm)_" & @CRLF & _
" (shared|static)_" & @CRLF & _
" (" & @CRLF & _
" ((?<=deb_shared_) # if there is "deb_shared_" before here" & @CRLF & _
" # then match" & @CRLF & _
" (wheezy|jessie|stretch|sid|trusty|utopic|vivid|wily|xenial)_" & @CRLF & _
" )" & @CRLF & _
" |" & @CRLF & _
" ((?<!deb_shared_) # if there is no "deb_shared_", don't match anything" & @CRLF & _
" )" & @CRLF & _
" )" & @CRLF & _
" )" & @CRLF & _
" |" & @CRLF & _
" ((?<!linux_) # if there is no "linux_", don't match anything" & @CRLF & _
" )" & @CRLF & _
" )" & @CRLF & _
" \g<arch>_(stable|nightly)_\g<buildtype>" & @CRLF & _
" )" & @CRLF & _
")$"
Local $sString = "qtox_pkg_linux_deb_shared_jessie_x86_stable_release"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH)
; 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