#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "\\([a-zA-Z]+ *|.|\n)"
Local $sString = "\documentclass {book}" & @CRLF & _
"\usepackage{a}" & @CRLF & _
"\begin {document}" & @CRLF & _
"\chapter*{This is the title of a index-absent chapter}" & @CRLF & _
"\I'll try to do some actual \LaTeX\ text to se\footnote {This is text in a footnote.} how it will be matched." & @CRLF & _
"" & @CRLF & _
"\chapter{This is {\bf another} chapter title}" & @CRLF & _
"You have to be carefull with accents, like ``Espa\~nol'' " & @CRLF & _
"and active characters (characters like the quotes above " & @CRLF & _
"or the newline character, which act by themselves as a " & @CRLF & _
"command).\" & @CRLF & _
"" & @CRLF & _
"You have to be carefull also with comments (beginning with" & @CRLF & _
"the percentage char) % this is one comment." & @CRLF & _
"" & @CRLF & _
"And of course you'll loose al your math, as in " & @CRLF & _
"$e^{i\pi} + 1 = 0$." & @CRLF & _
"" & @CRLF & _
"\end{document}" & @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