#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?:(?:[a-zA-Z0-9]+\d*[-_])*[a-zA-Z]+\d*(?:_64)?)"
Local $sString = "kernel-debug-modules-extra-4.18.0-80.2.el8.x86_64.rpm" & @CRLF & _
"kernel-debug2-modules-extra-4.18.0-80.2.el8.x86_64.rpm" & @CRLF & _
"kernel-debug-modules2-extra-4.18.0-80.2.el8.x86_64.rpm" & @CRLF & _
"kernel-debug3-modules-extra2-4.18.0-80.2.el8.x86_64.rpm" & @CRLF & _
"KERNEL-DEBUG-4.18.0-80.2.el8.x86_64.rpm" & @CRLF & _
"kernel-debug-core-4.18.0-80.2.el8.x86_64.rpm" & @CRLF & _
"kernel-debug-devel-4.18.0-80.2.el8.x86_64.rpm" & @CRLF & _
"kernel-debug-modules-4.18.0-80.2.el8.x86_64.rpm" & @CRLF & _
"2python3-perf-4.18.0-80.2.el8.x86_64.rpm" & @CRLF & _
"python3-perf2-4.18.0-80.2.el8.x86_64.rpm" & @CRLF & _
"kernel-debuginfo-common-x86_64-4.18.0-80.2.el8.x86_64.rpm" & @CRLF & _
"Kernel_debUginfo_common-x86_64-4.18.0-80.2.el8.x86_64.rpm" & @CRLF & _
"python3-4.18.0-80.2.el8.x86_64.rpm" & @CRLF & _
"python-4.18.0-80.2.el8.x86_64.rpm" & @CRLF & _
"" & @CRLF & _
"----" & @CRLF & _
"desired output (exlude words which starts with hypen and digit (-4.xxx) and exclude -x86_64):" & @CRLF & _
"kernel-debug-modules-extra" & @CRLF & _
"kernel-debug2-modules-extra" & @CRLF & _
"kernel-debug" & @CRLF & _
"python3" & @CRLF & _
"---" & @CRLF & _
"error:" & @CRLF & _
"python3-4.18.0-80.2.el8.x86_64.rpm - not matching single word" & @CRLF & _
"" & @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