- The first Regular Expression Library on the Web!

Please support RegExLib Sponsors


Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 2
Title Test Details Address in minor to major order
((?<strPOBox>((POBox|PO\sBox)\s*\d*)),?\s?)?(((?<strUnit>([\w\d\s\,]*)),\s?)?( (?<strStreet>([\w\s\-]*\w\s(st\s)?[\w]*\s(street|st|road|rd|close|cl|avenue|ave|av|path|ph|drive|drv|LOOP|COURT|CT|CIRCLE|LANE|LN)) ),?\s?))?((?<strTown>([\p{Ll}\p{Lu}\p{Lo}\p{Pc}\p{Lt}\p{Lm}\s]*)),?\s?)?((?<strState>(Victoria|VIC|New South Wales|NSW|South Australia|SA|Northern Territory|NT|West Australia|WA|Tasmania|TAS|ACT|Queensland|QLD))\s*)?(?<strPostalCode>(\d{4}),?\s?)?(?<strCountry>(Australia))?
This regular expression using named groups returns semantic tokens and is designed for Australian addresses in one line. Any part of an address may be omitted, as long as parts are in minor to major order. It should not be difficult to modify the regular express for analysing multi-line addresses. With a little modification, this regex may work for other postal address formats in minor to major order. The syntax is based on dot Net regular expression, with "options = RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace". The order is [POBox][ExtAdr][Street][Town][State][PostalCode][Country].
Shop S1, Sussex Centre, 401 Sussex St, Sydney | 28 Lidco Street, Arndell Park, Sydney 2148 | Level 1, 198 Elizabeth St, Surry Hills 2010 | Room 2, Level 1, 198 Elizabeth St, Surry Hills, NSW 2010 | 541 Pittwater Rd, Brookvale 2100 | 2 Maniangi Court, Macedon, 3440 | PO Box 1531, Keveland, QLD 4163 | St Lucia Golf Links, 22 St George St, St Lucia, QLD | PO Box 1531, St Lucia, QLD 4163
No man land
Author Rating: Not yet rated. Zijian
   Displaying page 1 of 1 pages; Items 1 to 2

Copyright © 2001-2018, | ASP.NET Tutorials