#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)\(.*?\)"
Local $sString = "I. Allegro (in B-flat major and in sonata form)" & @CRLF & _
"II. Tema con variazioni (Andante) (theme and 6 variations, where the theme and all the variations are in F major)" & @CRLF & _
"III. Menuetto - Trio (in B-flat major and in ternary form, trio in G minor)" & @CRLF & _
"IV. Adagio (in E-flat major and in sonata form)" & @CRLF & _
"V. Menuetto - Trio (in B-flat major and in ternary form, trio in E-flat major)" & @CRLF & _
"VI. Andante - Allegro molto (in B-flat major, beginning with an introductory instrumental recitative, and in sonata rondo form)"
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