#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(department(s)? of |in\n)(\w+ ?\w+[^,]?\w+[^,]?\w+[ ]?\w+[ ]?\w+)"
Local $sString = "Virginia Tech Sample:" & @CRLF & _
"A COMPARISON OF THE EFFICIENCY AND EFFECTIVENESS" & @CRLF & _
"OF TWO MODELS FOR DETERMINING THE COST" & @CRLF & _
"OF SPECIAL EDUCATION PROGRAMS" & @CRLF & _
"by" & @CRLF & _
"Kenneth L. Kienas" & @CRLF & _
"Dissertation submitted to the Faculty of the" & @CRLF & _
"Virginia Polytechnic Institute and State University" & @CRLF & _
"in partial fulfillment of the requirements for the degree of" & @CRLF & _
"DOCTOR OF EDUCATION" & @CRLF & _
"in" & @CRLF & _
"Administration and Supervision of Special Education" & @CRLF & _
"APPRQVED:" & @CRLF & _
"Richard G. Salmon, Co-Chairman Phili R. Jones, Co-Chairman" & @CRLF & _
"John A. McLaughlin Shirley A Jones" & @CRLF & _
"Shirley A. Underwood" & @CRLF & _
"May, 1986" & @CRLF & _
"Blacksburg, Virginia" & @CRLF & _
"--------------------------------------------------------" & @CRLF & _
"MIT Sample:" & @CRLF & _
"THE RESPONSE OF CONTINUOUS SYSTEMS" & @CRLF & _
"TO RANDOM NOISE FIELDS" & @CRLF & _
"by " & @CRLF & _
"Richard H. Lyon" & @CRLF & _
"A. B., Evansville College, 1952" & @CRLF & _
"Submitted in Partial Fulfillment of the" & @CRLF & _
"Requirements for the Degree of" & @CRLF & _
"Doctor of Philosophy" & @CRLF & _
"at the" & @CRLF & _
"MASSACHUSETTS INSTITUTE OF TECHNOLOGY" & @CRLF & _
"June, 1955" & @CRLF & _
"Signature of Author" & @CRLF & _
"department of Physics, May 16, 1955" & @CRLF & _
"Certified by" & @CRLF & _
"Thesis Supervisor" & @CRLF & _
"Accepted by" & @CRLF & _
"Chairman, Departmental Committee on Graduate, Students" & @CRLF & _
"---------------------------------------------------------" & @CRLF & _
"MIT Sample:" & @CRLF & _
"ON THE MECHANICS OF TWIST INSERTION" & @CRLF & _
"by" & @CRLF & _
"ALY H, M, EL-SHIEKH" & @CRLF & _
"B.Sc. University of Alexandria, U.A.R." & @CRLF & _
"1956" & @CRLF & _
"S.M. Massachusetts Institute of Technology" & @CRLF & _
"1961" & @CRLF & _
"M.E. Massachusetts Institute of Technology" & @CRLF & _
"1964" & @CRLF & _
"Submitted in Partial Fulfillment" & @CRLF & _
"of the Requirements for the" & @CRLF & _
"Degree of Doctor of Science" & @CRLF & _
"at the" & @CRLF & _
"MASSACHUSETTS INSTITUTE OF TECHNOLOGY" & @CRLF & _
"May 1965" & @CRLF & _
"Signature of the Author" & @CRLF & _
"department of Mechanical Engineering" & @CRLF & _
"Fibers and Polymers Division" & @CRLF & _
"Certified by" & @CRLF & _
"Thesis Supervisor" & @CRLF & _
"Accepted by" & @CRLF & _
"Chairman Departmental Committee on Graduate Students" & @CRLF & _
"------------------------------------------------------------" & @CRLF & _
"MIT Sample:" & @CRLF & _
"HYDRAULIC DAMPER DESIGN" & @CRLF & _
"FOR A KNEE PROSTHESIS" & @CRLF & _
"by" & @CRLF & _
"Eric Hershler Bott" & @CRLF & _
"Submitted in Partial Fulfillment" & @CRLF & _
"of the Requirements for the" & @CRLF & _
"Degree of Bachelor of Science" & @CRLF & _
"at the" & @CRLF & _
"MASSACHUSETTS INSTITUTE OF TECHNOLOGY" & @CRLF & _
"February, 1975" & @CRLF & _
"Signature of Author" & @CRLF & _
"departments of Mechanical Engineering and" & @CRLF & _
"Physics, February 23, 1975" & @CRLF & _
"Certified by" & @CRLF & _
"Thesis Supervisor" & @CRLF & _
"Accepted by" & @CRLF & _
"Chairman, Departmental Committee on Theses" & @CRLF & _
"MAR 15 1976" & @CRLF & _
"LIBRARIES" & @CRLF & _
"------------------------------------------------------------" & @CRLF & _
"Virginia Tech Sample:" & @CRLF & _
"ASSESSMENT OF A MENTOR PROGRAM" & @CRLF & _
"ON SELF-CONCEPT AND ACHIEVEMENT VARIABLES" & @CRLF & _
"OF MIDDLE SCHOOL UNDERACHIEVERS" & @CRLF & _
"by" & @CRLF & _
"Helene Aiello" & @CRLF & _
"Dissertation submitted to the faculty of the Virginia" & @CRLF & _
"Polytechnic Institute and State University in partial" & @CRLF & _
"fulfillment of the requirements for the degree of" & @CRLF & _
"Doctor of Education" & @CRLF & _
"in" & @CRLF & _
"Administration and Supervision" & @CRLF & _
"Of" & @CRLF & _
"Special Education" & @CRLF & _
"APPROVED:" & @CRLF & _
"Philip R. Jones, Chairman Kenneth Underwood" & @CRLF & _
"Sylvia Auton" & @CRLF & _
"Shirley Jones Ronald McKeen" & @CRLF & _
"February 22, 1988" & @CRLF & _
"Blacksburg, Virginia"
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