#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|6(?:011|5[0-9]{2})[0-9]{12}|(?:2131|1800|35\d{3})\d{11})$"
Local $sString = "# American Express" & @CRLF & _
"378282246310005" & @CRLF & _
"371449635398431" & @CRLF & _
"# American Express Corporate" & @CRLF & _
"378734493671000" & @CRLF & _
"# Diners Club" & @CRLF & _
"30569309025904" & @CRLF & _
"38520000023237" & @CRLF & _
"# Discover" & @CRLF & _
"6011111111111117" & @CRLF & _
"6011000990139424" & @CRLF & _
"# JCB" & @CRLF & _
"3530111333300000" & @CRLF & _
"3566002020360505" & @CRLF & _
"# MasterCard" & @CRLF & _
"5555555555554444" & @CRLF & _
"5105105105105100" & @CRLF & _
"# Visa" & @CRLF & _
"4111111111111111" & @CRLF & _
"4012888888881881" & @CRLF & _
"4222222222222" & @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