Page 1 of 1

Stuck on solution

Posted: Sat Apr 24, 2004 7:31 am
by Garren
I have a single file with a bunch of addresses and other info in them. This file is used in another process but I need the name and date to be on the same line.

Here is the first example:

JESSICA SMITH P 05-23-02
123 Main Street
VICTORIA BC 1550.00
V8V-1B9 CANADA RI 00001

notice the name and address are on the same line. Here is the second example:

P 05-23-02
WILLIAM JONES
191 MAIN ST 2222.00
BRISTOL NH 03222

When there are only 3 address lines the name and date aren't on the same line. I need a way for when there are only 3 address lines to delete the date line and insert it on name line or move the address lines up to the date line.

I noticed the BB reformated my text so here is an image of how the text with spaces is in the file:
Image

Any ideas?
Thanks,
Garren

Posted: Mon Apr 26, 2004 11:59 am
by DataMystic Support
Hi Garren,

Use a pattern match to find lines with say, 30 or more spaces followed by the P, then the date eg

[ ]{30,}P([^\r\n]*)\r\n([^\r\n]*?)

Replace with

$2 $1