#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?im)*((#\d+)|((box|bin)[-. \/\\]?\d+)|(.*p[ \.]? ?(o|0)[-. \/\\]? *-?((box|bin)|b|(num)?\d+))|(p(ost)? *(o(ff(ice)?)?)? *((box|bin)|b)? *\d+)|(p *-?\/?(o)? *-?box)|post office box|((box|bin)|b) *(number|num)? *\d+|(num|number) *\d+)\d"
Local $sString = "PO Box 234, Suburb, ACT, Australia, 5678" & @CRLF & _
"" & @CRLF & _
"123 Some Street" & @CRLF & _
"" & @CRLF & _
"PO BOX 234 Suburb, ACT, Australia, 2342" & @CRLF & _
"" & @CRLF & _
"po box 345, somehwere, state, country, postcode" & @CRLF & _
"" & @CRLF & _
"post office box 2343, nothing ,no state, country , 345" & @CRLF & _
"" & @CRLF & _
"345 smith st, po box 345, no place, no country, 3454" & @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