#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?im)^(?:([*_`]|\*\*|\[){0,1}[a-z]+)(.*)"
Local $sString = "# H1" & @CRLF & _
"## H2" & @CRLF & _
"### H3" & @CRLF & _
"" & @CRLF & _
"# A First Level Header" & @CRLF & _
"" & @CRLF & _
"## Second Level Header" & @CRLF & _
"" & @CRLF & _
"Now is the time for all good men to come to the aid of their country. This is just a regular paragraph." & @CRLF & _
"" & @CRLF & _
"The quick brown fox jumped over the lazy dog's back." & @CRLF & _
"" & @CRLF & _
"*The* quick brown fox jumped over the lazy dog's back." & @CRLF & _
"" & @CRLF & _
"**The** quick brown fox jumped over the lazy dog's back." & @CRLF & _
"" & @CRLF & _
"`The` quick brown fox jumped over the lazy dog's back." & @CRLF & _
"" & @CRLF & _
"[The]() quick brown fox jumped over the lazy dog's back." & @CRLF & _
"" & @CRLF & _
"### Header 3" & @CRLF & _
"" & @CRLF & _
"> This is a blockquote." & @CRLF & _
"> " & @CRLF & _
"> This is the second paragraph in the blockquote." & @CRLF & _
">" & @CRLF & _
"> ## This is an H2 in a blockquote"
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