#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^\[(\w+)\]$"
Local $sString = "[abilities]" & @CRLF & _
"UnknownName = ??? Ability" & @CRLF & _
"UnknownDescFun0 = No description." & @CRLF & _
"UnknownDescTech0 = This ability does not seem to have any purpose." & @CRLF & _
"" & @CRLF & _
"OneHitDeathName = 1-Hit Hero Badge" & @CRLF & _
"OneHitDeathDesc0 = You die in one hit. Only for the brave!" & @CRLF & _
"" & @CRLF & _
"AddElement = Test Text." & @CRLF & _
"" & @CRLF & _
"SuckInOrbsName = Item Magnet Badge" & @CRLF & _
"SuckInOrbsFun0 = Item just out of reach? No longer a problem!" & @CRLF & _
"SuckInOrbsTech0 = Automatically attract nearby collectibles!"" & @CRLF & _
"" & @CRLF & _
"[spac_eship]" & @CRLF & _
"[spac_eship]hub_alert_generic0 = …" & @CRLF & _
"hub_alert_generic1 = [icon:trophy][trophy]今年度鳥映画アワード[/trophy]は内部の者によって不正に染まっていた。" & @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