I have a Billing information extractor froma general text file, problem is occationally there's 2 lines of address, and sometimes there's 2 batches of address information
THE DATA IS FIXED WIDTH, i tried originally to use this to my benefit, but turned into a multi array nightmare.
current issue(s) :
1.some records have 2 address lines
2.billing vs shipping address (shipping always on RIGHT)
3.combination of either or both 1 & 2
** note, tax line (text) may not always be present, but the line holder is always there.
here's the pattern i'm using: ( works wonderfully for regular items, also there's carriage returns in this, for ease of viewing, will need to remove those in use. )
currently this works fine for the middle sample, with and without tax value. yet fails on the other 2 samples.
items needed are in bold in the sample text: ( formatting gets chewed up unfortunately in code brackets, might need to view source )
DreX
aKa - Robert
THE DATA IS FIXED WIDTH, i tried originally to use this to my benefit, but turned into a multi array nightmare.
current issue(s) :
1.some records have 2 address lines
2.billing vs shipping address (shipping always on RIGHT)
3.combination of either or both 1 & 2
** note, tax line (text) may not always be present, but the line holder is always there.
here's the pattern i'm using: ( works wonderfully for regular items, also there's carriage returns in this, for ease of viewing, will need to remove those in use. )
Code:
(\r\n[^\r\n\d]*\d\s+(\b\d+?.?\d{2}\b))
(?:[\r\n])
(?:\s*TAX\s+)?(\b\d*.\d{2}\b)?
(?:[\r\n]\s*)
(?:[\r\n]\s*)
(?:[\r\n]\s*)
(?:[\r\n]\s+(\d+?.?\d{2}))
([\s|\S]*?)
(\d{6})
(?:[\r\n]\s*)
([^\s\r\n]+( [^\s\r\n]+)*)(?:[^\r\n]*)
(?:[\r\n]\s*)
([^\r\n]*)
(?:[\r\n]\s*)
([^\r\n]*)\s([a-z]{2})\s(\d{5}(-\d{4})?)
items needed are in bold in the sample text: ( formatting gets chewed up unfortunately in code brackets, might need to view source )
Code:
MOUNT FIRST NOTICES
1ST NOTICE
123456 06 24 04 07 15 04
52
WEEKS
LOCAL NEWS LOCAL NEWS 1 [HIGHLIGHT]45.00[/HIGHLIGHT]
[HIGHLIGHT]45.00[/HIGHLIGHT]
1ST NOTICE
[HIGHLIGHT]123456[/HIGHLIGHT]
JIM JONES [HIGHLIGHT]JAMES JONES[/HIGHLIGHT] EMIXED
30 MAPLE LAWN DR [HIGHLIGHT]30 MAPLE LAWN DRIVE[/HIGHLIGHT]
SANTE FE VT 12345-1234 [HIGHLIGHT]SANTE FE VT 12345[/HIGHLIGHT]
2ND NOTICE
654321 06 24 04 05 27 04
52
WEEKS
LOCAL EXPLORER LOCAL EXP. 1 [HIGHLIGHT]30.00[/HIGHLIGHT]
TAX [HIGHLIGHT]2.19[/HIGHLIGHT]
[HIGHLIGHT]32.19[/HIGHLIGHT]
PLEASE DISREGARD THIS REMINDER NOTICE IF YOU HAVE
ALREADY MAILED PAYMENT. THANK YOU.
[HIGHLIGHT]654321[/HIGHLIGHT]
[HIGHLIGHT]STEVE SMITH[/HIGHLIGHT] DLOCAL
[HIGHLIGHT]17215 TOWER RD[/HIGHLIGHT]
[HIGHLIGHT]PARIS DE 12345[/HIGHLIGHT]
1ST NOTICE
645123 06 24 04 07 15 04
52
WEEKS
LOCAL EXPLORER LOCAL EXP. 1 [HIGHLIGHT]30.00[/HIGHLIGHT]
TAX [HIGHLIGHT]2.26[/HIGHLIGHT]
[HIGHLIGHT]32.26[/HIGHLIGHT]
1ST NOTICE
[HIGHLIGHT]645123[/HIGHLIGHT]
[HIGHLIGHT]SUSAN DOE[/HIGHLIGHT] DLOCAL
[HIGHLIGHT]NWCC LIBRARY BUILDING[/HIGHLIGHT]
[HIGHLIGHT]1234 MAIN ST[/HIGHLIGHT]
[HIGHLIGHT]KANSAS CITY MO 1234[/HIGHLIGHT]
![[thumbsup2] [thumbsup2] [thumbsup2]](/data/assets/smilies/thumbsup2.gif)
aKa - Robert