I develop a lot of data parsers and continuously run into composite mailing addresses that require to be split into their meta collections. The following Regex pattern will reformat these two style addresses into XML tag elements.

SAMPLE ADDRESS DATA:

1200 Ocean Rd., Narragansett, RI 02882
1200 Ocean Rd., Narragansett, RI 02882-1234

FIND PATTERN USING REGEX:

REPLACE WITH XML FORMAT:

OUTPUT:

<address>1200 Ocean Rd.</address>
<city>Narragansett</city>
<state>RI</state>
<zip>02882</zip>

Leave a Reply

Your email address will not be published. Required fields are marked *