#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?<=<[^>]*)(?<=\s)(on\w+|formaction|action)=["']?(.*?)["']?(?=[\n>])"
Local $sString = "<img src="/name">" & @CRLF & _
"<a href="javascript:void">some url</a>" & @CRLF & _
"<a href="https://convertkit.com">URL</a>" & @CRLF & _
"<img src=x onerror="alert(document.domain)">" & @CRLF & _
"<img src=x onerror=" alert(document.domain) ">" & @CRLF & _
"<img src=x" & @CRLF & _
"onerror="alert(document.domain)"" & @CRLF & _
">" & @CRLF & _
"<img src=x onerror=alert(document.domain)>" & @CRLF & _
"<button form="form1" formaction="javascript:alert(1)">Submit</button>" & @CRLF & _
"<form action=""></form>" & @CRLF & _
"<button onclick="hacked()">Hack</button>" & @CRLF & _
"<a href="https://convertkit.com/about?utm_content=bazard">click men</a>" & @CRLF & _
"<div>onmouseover=alert(1)</div>" & @CRLF & _
"<div> onmouseover=alert(1) </div>"
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