#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?<name>[A-Z][a-z]{3,7})(\s+(?<family>[A-Z][a-z]{2,}))?(\s+(?<facultyNumber>\d{5,10}))?$"
Local $sString = "Valid All 12345" & @CRLF & _
"Valid Names" & @CRLF & _
"With 123456" & @CRLF & _
"Name" & @CRLF & _
"Invalid Faculcy 111111111111111" & @CRLF & _
"Invalid family 22222222" & @CRLF & _
"invalid Name 33333333" & @CRLF & _
"Verylongname Error" & @CRLF & _
"InvaliD Name 44444" & @CRLF & _
"Invalid FamilY 55555" & @CRLF & _
"Name12345" & @CRLF & _
"Long Familiiiiiiiiiiiiiiiii 12345"
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