#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?im)(?:^(?:<[^>]*>)?|\s)(he|lead[a-z]*)\b"
Local $sString = "Leading a team of 5." & @CRLF & _
"You will be leading a team of 5" & @CRLF & _
"<span style="color:#f0f;">Leading a team of 5</span>" & @CRLF & _
"The code is ok" & @CRLF & _
"He is a good coder" & @CRLF & _
"test the leading test !@#$leading" & @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