#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?im)([-*]+[\t ]*\b(edit|update)\b([\t ]*#?[0-9]+)?[\t ]*:*[\t ]*[-*]+|[\t ]*\b(edit|update)\b([\t ]*#?[0-9]+)?\s*:+[\t ]*)"
Local $sString = "Match & remove "edit" and "update", leaving surrounding useful text. If formatting is useful without the removed text, leave it; otherwise remove it, too. Don't remove trailing spaces or line feeds." & @CRLF & _
"" & @CRLF & _
"UPDATE: changed the example to show use," & @CRLF & _
"" & @CRLF & _
"Edit: Something different" & @CRLF & _
"" & @CRLF & _
"**EDIT** I really mean this one..." & @CRLF & _
"" & @CRLF & _
"Edit #2: " & @CRLF & _
"" & @CRLF & _
"-- Edit --" & @CRLF & _
"" & @CRLF & _
"**Edit: More precise explanation:**" & @CRLF & _
"" & @CRLF & _
"-----------------------------------------------" & @CRLF & _
"Since "edit" and "update" are not inherently bad words, leave normal use of them:" & @CRLF & _
"" & @CRLF & _
"I'm going to edit my question. Better not match any of this update here." & @CRLF & _
"" & @CRLF & _
"Edit the file to..." & @CRLF & _
"" & @CRLF & _
"Update for anyone who cares:" & @CRLF & _
"" & @CRLF & _
"Update for nobody." & @CRLF & _
"" & @CRLF & _
"***editprofile.js***" & @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