I may be teaching grannies to suck eggs, but here goes anyway ... IMO, you need to identify and use, one, or more, invariant properties of the address block e.g. ...

Even better is if, of the invariants thus identified, at least one can be demonstrated to be unique for the address block.

In your supplementary data example, it would appear that the address block is the 3rd block where each block is separated from the next by \n{2,}.

Having identified and isolated the address block, it then becomes a simpler matter of parsing the address details...

Thinx: OTOH, there may be a chance that the address is stored as a formatted block in the Word doc - so using Win32::OLE may be a first step to read the object direct from the doc...

Thinx again: It's highly probable that a combination of the 2 would be required to handle to inconsistencies introduced by the evolution of the doc...

A user level that continues to overstate my experience :-))

In reply to Re: Extracting a (UK) Address by Bloodnok
in thread Extracting a (UK) Address by ropey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.