#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)\b[0-9]{10}\b"
Local $sString = "National Provider Identifier" & @CRLF & _
"Requirements: 10 consecutive digit number" & @CRLF & _
"" & @CRLF & _
"Pattern:" & @CRLF & _
"\b[0-9]{10}\b" & @CRLF & _
"" & @CRLF & _
"Test Cases:" & @CRLF & _
"Positive (should fire):" & @CRLF & _
"10 digits consecutively 1234507890" & @CRLF & _
"Embedded in text with spaces NPI: oops 1234507890 there is text here" & @CRLF & _
"" & @CRLF & _
"Negative (should not fire):" & @CRLF & _
"Too many digits 12345078901" & @CRLF & _
"Not consecutive 1234567-890" & @CRLF & _
"" & @CRLF & _
"Embedded in text no spaces oops1234507890there is text here" & @CRLF & _
"" & @CRLF & _
"Phone number formats:" & @CRLF & _
"2028080012 (this one will fire, false positive)" & @CRLF & _
"202-808-0012" & @CRLF & _
"202.808.0012" & @CRLF & _
"202 808 0012 "
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