#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?ms).+?(\d{4})<\/i>\)"
Local $sString = "<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">" & @CRLF & _
"<HTML>" & @CRLF & _
" <HEAD>" & @CRLF & _
" <TITLE>" & @CRLF & _
" A Small Hello" & @CRLF & _
" </TITLE>" & @CRLF & _
" </HEAD>" & @CRLF & _
"<BODY>" & @CRLF & _
" <H1>Hi</H1>" & @CRLF & _
" <P>This is very minimal "hello world" HTML document.</P>" & @CRLF & _
" <H1>Hi</H1>" & @CRLF & _
" <P>This is very minimal "hello world" HTML document.</P> <H1>Hi</H1>" & @CRLF & _
" <P>This is very minimal "hello world" HTML document.</P> <H1>Hi</H1>" & @CRLF & _
" <P>This is very minimal "hello world" HTML document.</P> <H1>Hi</H1>" & @CRLF & _
" <P>This is very minimal "hello world" HTML document.</P> <H1>Hi</H1>" & @CRLF & _
" <P>This is very minimal "hello world" HTML document.</P> <H1>Hi</H1>" & @CRLF & _
" <P>This is very minimal "hello world" HTML document.</P> <H1>Hi</H1>" & @CRLF & _
" <P>This is very minimal "hello world" HTML document.</P> <H1>Hi</H1>" & @CRLF & _
" <P>This is very minimal "hello world" HTML document.</P> <H1>Hi</H1>" & @CRLF & _
" <P>This is very minimal "hello world" HTML document.</P> <H1>Hi</H1>" & @CRLF & _
" <P>This is very minimal "hello world" HTML document.</P> <H1>Hi</H1>" & @CRLF & _
" <P>This is very minimal "hello world" HTML document.</P>" & @CRLF & _
"<i>1921</i>)" & @CRLF & _
"</BODY>" & @CRLF & _
"</HTML>"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH)
; 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