#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^((?:[ \-]?[A-Z][a-z]+|[A-Z][a-z]?\.?)+)(?: ?[A-Z]\.?)* ([A-Za-z]{,3}(?:[ \-]?[A-Z]'?[A-Z]?[a-z]+\.?,?)+[A-Z \-.]*)$"
Local $sString = "Joel Dorfman" & @CRLF & _
"David C. Thomas" & @CRLF & _
"George Stager III" & @CRLF & _
"Jerome Jay Allen" & @CRLF & _
"Shaunda Richardson-Snell" & @CRLF & _
"Shelley J. O'Brien" & @CRLF & _
"Anthony Stiel, Jr." & @CRLF & _
"James Van Harn II" & @CRLF & _
"L. Marcinkowski" & @CRLF & _
"S.M. Rutkowski" & @CRLF & _
"S. M. Rutkowski" & @CRLF & _
"E. Todd Brown" & @CRLF & _
"Marc A. ORourke" & @CRLF & _
"James CW Roberts III" & @CRLF & _
"Holly A. McClellan" & @CRLF & _
"Thomas-Robert Peterson" & @CRLF & _
"Annette DeLaHuerta" & @CRLF & _
"Wm. Craig Faulk" & @CRLF & _
"JD Haughey" & @CRLF & _
"Adam de Angeli" & @CRLF & _
"Keith den Hollander"
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