#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?ms)^\d+\.\s+(?:(?!^\d+\.\s).)*\bthe Agency\b(?:(?!^\d+\.\s).)*"
Local $sString = "where sucts. " & @CRLF & _
"1. The objectives of the STh other arrangements are not inconsistent or in conflict with this licence " & @CRLF & _
"or the STC or other relevant statutory requirements. " & @CRLF & _
"3. The objectives of the STC referred to in sub-paragraph 1(c) are the:" & @CRLF & _
"(a) efficient discharge of the obligations imposed upon transmission licensees by " & @CRLF & _
"transmission licences and the Act;" & @CRLF & _
"(b) compliance with the Electricity Regulation and any relevant legally binding " & @CRLF & _
"decision of the European Commission and/or the Agency." & @CRLF & _
"4. The STC shall provide for:" & @CRLF & _
"(a) there to be referred to the Authority for determination such matters arising under " & @CRLF & _
"the STC as may be specified in the STC; " & @CRLF & _
"(b) a copy of the STC or any part(s) thereof" & @CRLF & _
"5. We know that" & @CRLF & _
"the Agency does" & @CRLF & _
"good work." & @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