#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?i)(p\.?\s?[o|0]\.?\s?b\.?([o|0]x)?|post\soffice\sbox)"
Local $sString = "Pembroke St" & @CRLF & _
"Poembroke St" & @CRLF & _
"Portsea Boxhill" & @CRLF & _
"P O Box" & @CRLF & _
"P.O. Box" & @CRLF & _
"P O B O X" & @CRLF & _
"Pobox" & @CRLF & _
"PO BOX" & @CRLF & _
"P.O BOX" & @CRLF & _
"P0 B0X" & @CRLF & _
"Po 8ox" & @CRLF & _
"POST OFFICE Box 123" & @CRLF & _
"PO Box 123" & @CRLF & _
"Post Office st" & @CRLF & _
" po box" & @CRLF & _
"UNIT 210 2 PEMBROKE ST" & @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