#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^\s*?((?:virtual\s*|const\s*|friend\s*){0,3})\s*([\w]*?)\s*\w+\s*::\s*([\w]+)\s*(\(.*\))\s*(const)?\s*[{|:]"
Local $sString = "#include <iostream>" & @CRLF & _
"#include <iomanip>" & @CRLF & _
"#include "Time.h"" & @CRLF & _
"using namespace std;" & @CRLF & _
"" & @CRLF & _
"Time :: Time(const int h, const int m, const int s) " & @CRLF & _
" : hour(h), minute (m), second(s)" & @CRLF & _
"{}" & @CRLF & _
"" & @CRLF & _
"virtual const void Time :: setTime(const int h, const int m, const int s) " & @CRLF & _
"{" & @CRLF & _
" hour = h;" & @CRLF & _
" minute = m;" & @CRLF & _
" second = s; " & @CRLF & _
"} " & @CRLF & _
" " & @CRLF & _
"std::string Time :: print() const" & @CRLF & _
"{" & @CRLF & _
" cout << setw(2) << setfill('0') << hour << ":"" & @CRLF & _
" << setw(2) << setfill('0') << minute << ":"" & @CRLF & _
" << setw(2) << setfill('0') << second << "\n"; " & @CRLF & _
" " & @CRLF & _
"}" & @CRLF & _
" " & @CRLF & _
"bool Time :: equals(const Time &otherTime)" & @CRLF & _
"{" & @CRLF & _
" if(hour == otherTime.hour " & @CRLF & _
" && minute == otherTime.minute " & @CRLF & _
" && second == otherTime.second)" & @CRLF & _
" return true;" & @CRLF & _
" else" & @CRLF & _
" return false;" & @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