#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?i)[A-Z]{1,2}[0-9][0-9A-Z]?\s?[0-9][A-Z]{2}"
Local $sString = "Uxbridge Road, Southall UB1 3HH, United Kingdom" & @CRLF & _
"Richmond TW9 1QJ, United Kingdom" & @CRLF & _
"CF24 3DG" & @CRLF & _
"" & @CRLF & _
"SW6 1AA" & @CRLF & _
"" & @CRLF & _
"NW10 6RB" & @CRLF & _
"" & @CRLF & _
"W11 3SJ" & @CRLF & _
"" & @CRLF & _
"W11 3SJ" & @CRLF & _
"" & @CRLF & _
"NW3 6LU" & @CRLF & _
"" & @CRLF & _
"NW10 6RB" & @CRLF & _
"" & @CRLF & _
"EC1A 9JX" & @CRLF & _
"" & @CRLF & _
"WC2A #Order for 671500" & @CRLF & _
"27 Newman's Row" & @CRLF & _
"London" & @CRLF & _
"WC2A" & @CRLF & _
"" & @CRLF & _
"2 West Smithfield" & @CRLF & _
"London" & @CRLF & _
"EC1A 9JX" & @CRLF & _
"" & @CRLF & _
"EC1A 9JX" & @CRLF & _
"" & @CRLF & _
"N1 6BS" & @CRLF & _
"" & @CRLF & _
"EC1A 9JX" & @CRLF & _
"" & @CRLF & _
"WC2H 0EB" & @CRLF & _
"" & @CRLF & _
"WC1X 8LT" & @CRLF & _
"" & @CRLF & _
"N1 0NY" & @CRLF & _
"" & @CRLF & _
"NW10 6RB" & @CRLF & _
"" & @CRLF & _
"BS98 1TL TV Licensing[44]" & @CRLF & _
"BX1 1LT Lloyds Bank formerly known as Lloyds TSB Bank[45] – non-geographic address" & @CRLF & _
"BX2 1LB Bank of Scotland (part of Lloyds Banking Group)[46] – non-geographic address" & @CRLF & _
"BX3 2BB Barclays Bank[47] – non-geographic address" & @CRLF & _
"BX4 7SB TSB Bank" & @CRLF & _
"BX5 5AT VAT Central Unit of HM Revenue and Customs[48] (Roman numeral "VAT" = "5AT") – non-geographic address" & @CRLF & _
"CF10 1BH Lloyds Banking Group (formerly Black Horse Finance)" & @CRLF & _
"CF99 1NA National Assembly for Wales" & @CRLF & _
"CV4 8UW University of Warwick" & @CRLF & _
"CV35 0DB Aston Martin after their long line of iconic sports cars that bear the "DB" moniker" & @CRLF & _
"DA1 1RT Dartford F.C. (nicknamed The Darts)" & @CRLF & _
"DE99 3GG Egg Banking" & @CRLF & _
"DE55 4SW Slimming World" & @CRLF & _
"DH98 1BT British Telecom" & @CRLF & _
"DH99 1NS National Savings certificates administration" & @CRLF & _
"E14 5HQ HSBC headquarters" & @CRLF & _
"E16 1XL ExCeL London[49]" & @CRLF & _
"E20 2AQ Olympic Aquatics Centre" & @CRLF & _
"E20 2BB Olympic Basketball Arena" & @CRLF & _
"E20 2ST Olympic Stadium" & @CRLF & _
"E20 3BS Olympic Broadcast Centre" & @CRLF & _
"E20 3EL Olympic Velodrome" & @CRLF & _
"E20 3ET Olympic Eton Manor Tennis Courts" & @CRLF & _
"E20 3HB Olympic Handball Arena" & @CRLF & _
"E20 3HY Olympic Hockey Stadium" & @CRLF & _
"E98 1SN The Sun newspaper" & @CRLF & _
"E98 1ST The Sunday Times newspaper" & @CRLF & _
"E98 1TT The Times newspaper" & @CRLF & _
"EC2N 2DB Deutsche Bank" & @CRLF & _
"EC4Y 0HQ Royal Mail Group Ltd headquarters" & @CRLF & _
"EH12 1HQ Royal Bank of Scotland headquarters" & @CRLF & _
"EH99 1SP Scottish Parliament[50] (founded in 1999)" & @CRLF & _
"G58 1SB National Savings Bank (the district number 58 also approximates the outline of the initials SB)" & @CRLF & _
"GIR 0AA Girobank (now Santander Corporate Banking)" & @CRLF & _
"IV21 2LR Two Lochs Radio" & @CRLF & _
"L30 4GB Girobank (alternative geographic postcode)" & @CRLF & _
"LS98 1FD First Direct bank" & @CRLF & _
"N1 9GU The Guardian newspaper" & @CRLF & _
"N81 1ER Electoral Reform Services[40][51]" & @CRLF & _
"NE1 4ST St James' Park Stadium, Newcastle United" & @CRLF & _
"NG80 1EH Experian Embankment House" & @CRLF & _
"NG80 1LH Experian Lambert House" & @CRLF & _
"NG80 1RH Experian Riverleen House" & @CRLF & _
"NG80 1TH Experian Talbot House" & @CRLF & _
"PH1 5RB Royal Bank of Scotland Perth Chief Office" & @CRLF & _
"PH1 2SJ St Johnstone Football Club" & @CRLF & _
"S2 4SU Sheffield United Football Club" & @CRLF & _
"S6 1SW Sheffield Wednesday Football Club" & @CRLF & _
"S14 7UP The World Snooker Championships at the Crucible Theatre, Sheffield;[52] 147 UP refers to a maximum lead (from a maximum break) in snooker" & @CRLF & _
"SA99 Driver and Vehicle Licensing Agency All postcodes starting with SA99 are for the DVLA offices in the Morriston area of Swansea, the final part of the postcode relates to the specific office or department within the DVLA" & @CRLF & _
"SE1 8UJ Union Jack Club" & @CRLF & _
"SM6 0HB Homebase Limited" & @CRLF & _
"SN38 1NW Nationwide Building Society" & @CRLF & _
"SW1A 0AA House of Commons" & @CRLF & _
"SW1A 0PW House of Lords (Palace of Westminster; see above for House of Commons)" & @CRLF & _
"SW1A 1AA Buckingham Palace (the Monarch)" & @CRLF & _
"SW1A 2AA 10 Downing Street (the Prime Minister)" & @CRLF & _
"SW1A 2AB 11 Downing Street (Chancellor of the Exchequer)" & @CRLF & _
"SW1H 0TL Transport for London (Windsor House, 50 Victoria Street)" & @CRLF & _
"SW1P 3EU European Commission and European Parliament office (European Union)" & @CRLF & _
"SW1W 0DT The Daily Telegraph newspaper" & @CRLF & _
"TW8 9GS GlaxoSmithKline" & @CRLF & _
"W1A 1AA BBC Broadcasting House" & @CRLF & _
"W1D 4FA Betgenius, the former address of The Football Association" & @CRLF & _
"W1N 4DJ BBC Radio 1 (disc jockey)" & @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