#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?i)^(?:NPO|PRO|PCR|REQ|8)+(\d{7,8})(?!(\d))"
Local $sString = "NPO1234567" & @CRLF & _
"NPO12345678" & @CRLF & _
"NPO123456" & @CRLF & _
"NPO123456789" & @CRLF & _
"npo1234567" & @CRLF & _
"npo12345678" & @CRLF & _
"npo123456" & @CRLF & _
"npo123456789" & @CRLF & _
"PRO1234567" & @CRLF & _
"PRO12345678" & @CRLF & _
"PRO123456" & @CRLF & _
"PRO123456789" & @CRLF & _
"pro1234567" & @CRLF & _
"pro12345678" & @CRLF & _
"pro123456" & @CRLF & _
"pro123456789" & @CRLF & _
"PCR1234567" & @CRLF & _
"PCR12345678" & @CRLF & _
"PCR123456" & @CRLF & _
"PCR123456789" & @CRLF & _
"pcr1234567" & @CRLF & _
"pcr12345678" & @CRLF & _
"pcr123456" & @CRLF & _
"pcr123456789" & @CRLF & _
"REQ1234567" & @CRLF & _
"REQ12345678" & @CRLF & _
"REQ123456" & @CRLF & _
"REQ123456789" & @CRLF & _
"req1234567" & @CRLF & _
"req12345678" & @CRLF & _
"req123456" & @CRLF & _
"req123456789" & @CRLF & _
"81234567" & @CRLF & _
"812345678" & @CRLF & _
"8123456" & @CRLF & _
"8123456789" & @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