#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])"
Local $sString = "AL Alabama" & @CRLF & _
"AK Alaska" & @CRLF & _
"AZ Arizona" & @CRLF & _
"AR Arkansas" & @CRLF & _
"CA California" & @CRLF & _
"CO Colorado" & @CRLF & _
"CT Connecticut" & @CRLF & _
"DE Delaware" & @CRLF & _
"DC District of Columbia" & @CRLF & _
"FL Florida" & @CRLF & _
"GA Georgia" & @CRLF & _
"HI Hawaii" & @CRLF & _
"ID Idaho" & @CRLF & _
"IL Illinois" & @CRLF & _
"IN Indiana" & @CRLF & _
"IA Iowa" & @CRLF & _
"KS Kansas" & @CRLF & _
"KY Kentucky" & @CRLF & _
"LA Louisiana" & @CRLF & _
"ME Maine" & @CRLF & _
"MD Maryland" & @CRLF & _
"MA Massachusetts" & @CRLF & _
"MI Michigan" & @CRLF & _
"MN Minnesota" & @CRLF & _
"MS Mississippi" & @CRLF & _
"MO Missouri" & @CRLF & _
"MT Montana" & @CRLF & _
"NE Nebraska" & @CRLF & _
"NV Nevada" & @CRLF & _
"NH New Hampshire" & @CRLF & _
"NJ New Jersey" & @CRLF & _
"NM New Mexico" & @CRLF & _
"NY New York" & @CRLF & _
"NC North Carolina" & @CRLF & _
"ND North Dakota" & @CRLF & _
"OH Ohio" & @CRLF & _
"OK Oklahoma" & @CRLF & _
"OR Oregon" & @CRLF & _
"PA Pennsylvania" & @CRLF & _
"RI Rhode Island" & @CRLF & _
"SC South Carolina" & @CRLF & _
"SD South Dakota" & @CRLF & _
"TN Tennessee" & @CRLF & _
"TX Texas" & @CRLF & _
"UT Utah" & @CRLF & _
"VT Vermont" & @CRLF & _
"VA Virginia" & @CRLF & _
"WA Washington" & @CRLF & _
"WV West Virginia" & @CRLF & _
"WI Wisconsin" & @CRLF & _
"WY Wyoming"
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