#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?i)(?:[a-z]+_and_)?(?P<superhero>[a-z]+man)(?:_and_[a-z]+)?(?:\s|$)"
Local $sString = "hemn_and_orkoman" & @CRLF & _
"superman" & @CRLF & _
"spiderman_and_villan" & @CRLF & _
"lizardman_fake_and_silly" & @CRLF & _
"butterflymanandroses" & @CRLF & _
"man" & @CRLF & _
"GucciMane" & @CRLF & _
"thelma_and_megaman" & @CRLF & _
"snakeman_and_dubious" & @CRLF & _
"amansquito_and_corner_case" & @CRLF & _
"aquaman"
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