#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mi)(^\s?[^qvx][^ijz]?[0-9]{1,2}[A,B,C,D,E,F,G,H,J,K,S,T,U,W]?\s?[0-9][^CIKMOV]{2}\s?)"
Local $sString = "cv12ar" & @CRLF & _
"cv379ry" & @CRLF & _
"M1 1AA" & @CRLF & _
"M60 1NW" & @CRLF & _
"CR2 6XH" & @CRLF & _
"DN55 1PT" & @CRLF & _
"W1A 1HQ" & @CRLF & _
"EC1A 1BB" & @CRLF & _
"QC1A 1BB" & @CRLF & _
"EI1A 1BB" & @CRLF & _
"EI1x 1BB " & @CRLF & _
"cvvccvv" & @CRLF & _
"cvvc cvv" & @CRLF & _
"cvv ccvv" & @CRLF & _
"" & @CRLF & _
"" & @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