#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)<!--.*?-->\n{2}(?!---)"
Local $sString = "### Alias" & @CRLF & _
"" & @CRLF & _
"Q: what check to do before creating an alias?" & @CRLF & _
"" & @CRLF & _
"A: check whether any other command exists by that name using `type new-alias-name`" & @CRLF & _
"<!--ID: 1643091253375-->" & @CRLF & _
"" & @CRLF & _
"---" & @CRLF & _
"" & @CRLF & _
"Q: syntax to create an alias?" & @CRLF & _
"" & @CRLF & _
"A: `alias name='string'`" & @CRLF & _
"<!--ID: 1645446702965-->" & @CRLF & _
"" & @CRLF & _
"- no spaces before or after the equal sign" & @CRLF & _
"- single quotes around the command sequence" & @CRLF & _
"![[Pasted image 20220125092954.png]]" & @CRLF & _
"<!--ID: 1643091253408-->" & @CRLF & _
"" & @CRLF & _
"---" & @CRLF & _
"" & @CRLF & _
"### Redirection/Piping" & @CRLF & _
"" & @CRLF & _
"Q: output of `> ls-output.txt`" & @CRLF & _
"" & @CRLF & _
"A: the file will be truncated if it exists or it would be created." & @CRLF & _
"<!--ID: 1645087988730-->" & @CRLF & _
"" & @CRLF & _
"- Simply using the redirection operator with no command preceding it will truncate an existing file or create a new empty file" & @CRLF & _
"<!--ID: 1643351731943-->" & @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