#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(\w.*?)(?: (?:[JjSs]r\.|[XVICMD]+\b))?,"
Local $sString = "O'Kefe,Shiley" & @CRLF & _
"Folenza,Mitchel V" & @CRLF & _
"Briscoe Jr.,Sanford Ray" & @CRLF & _
"Andade-Alarenga,Blnca " & @CRLF & _
"De La Cru,Feando" & @CRLF & _
"Carone,Letca Jo" & @CRLF & _
"O'Conor,Mole K" & @CRLF & _
"Daeron III,Lawence P" & @CRLF & _
"Randall,Jason L" & @CRLF & _
"Esquel Mendez,Mara D" & @CRLF & _
"Dinle III,Jams E" & @CRLF & _
"Coras Sr.,Cleybr E" & @CRLF & _
"Hsieh-Krnk,Caolyn E" & @CRLF & _
"Graves II,Theodore R" & @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