#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "<!-- @\[(?<component>[\w+]+)\(*(?<classes>[\w+]+)*\)*\] -->"
Local $sString = "<!-- @[Hero] -->" & @CRLF & _
"" & @CRLF & _
"# Creating new contexts" & @CRLF & _
"" & @CRLF & _
"<!-- @[UsageExample] -->" & @CRLF & _
"" & @CRLF & _
"## Usage example" & @CRLF & _
"" & @CRLF & _
"```javascript" & @CRLF & _
" Import { ICON_NAME } from 'Icons'" & @CRLF & _
"```" & @CRLF & _
"" & @CRLF & _
"<!-- @[/Hero] -->" & @CRLF & _
"" & @CRLF & _
"<!-- @[ArticleSection] -->" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"## Section Title" & @CRLF & _
"" & @CRLF & _
"### Section subtitle that contains additional information" & @CRLF & _
"" & @CRLF & _
"Cillum ipsum ad veniam elit non. Sunt ea ut quis qui dolore id voluptate magna. Ex non commodo reprehenderit ipsum irure. Ad excepteur nulla ullamco et deserunt magna et sint reprehenderit sint esse commodo. Tempor duis anim nisi commodo incididunt ut ex et sunt laborum excepteur ea culpa laborum." & @CRLF & _
"" & @CRLF & _
"<!-- @[NoteBlock(warning)] -->" & @CRLF & _
"" & @CRLF & _
"> #### Be Careful" & @CRLF & _
"> Eu laboris eiusmod ut exercitation minim laboris ipsum magna consectetur est [commodo](/nope)." & @CRLF & _
"" & @CRLF & _
"<!-- @[/NoteBlock] -->" & @CRLF & _
"" & @CRLF & _
"Officia esse Lorem ad duis dolore nostrud ex elit aliqua incididunt sint ad ex. Eiusmod do in ad aute nulla eiusmod tempor Lorem non. Qui sunt voluptate laborum mollit elit adipisicing minim dolore voluptate veniam incididunt proident ullamco. Ipsum est cupidatat occaecat pariatur ut aute." & @CRLF & _
"" & @CRLF & _
"<!-- @[CodeExample] -->" & @CRLF & _
"" & @CRLF & _
"#### Code example" & @CRLF & _
"" & @CRLF & _
"```javascript" & @CRLF & _
" class ScrollingList extends React.Component {" & @CRLF & _
" constructor(props) {" & @CRLF & _
" super(props);" & @CRLF & _
" this.listRef = React.createRef();" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" render() {" & @CRLF & _
" return (" & @CRLF & _
" <div ref={this.listRef}>{/* ...contents... */}</div>" & @CRLF & _
" );" & @CRLF & _
" }" & @CRLF & _
" }" & @CRLF & _
"```" & @CRLF & _
"" & @CRLF & _
"<!-- @[PropsTable] -->" & @CRLF & _
"" & @CRLF & _
"#### Props" & @CRLF & _
"" & @CRLF & _
"Prop Name | Value | Required" & @CRLF & _
"--------- | ----- | --------" & @CRLF & _
"**label** | `{String}` | true" & @CRLF & _
"**state** | `default` `secondary` `info` `warning` `danger` | false" & @CRLF & _
"**size** | `xs` `s` `m` `l` `xl` | false" & @CRLF & _
"**disabled** | `-` | false" & @CRLF & _
"" & @CRLF & _
"<!-- @[/ArticleSection] -->" & @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