Page 1 of 1

selecting between markers

Posted: 2008-01-05 17:47:44
by danbond
I'm getting lots of e-mailed forms. I'd like to reformat them to import to my database.

What I get:
Last: data1
First: data2

What I need:
data1<tab>data2 etc.

if it's in tfm I can't don't get it.

Thanks for your help.

Posted: 2008-01-07 06:29:17
by martin
This is really more a question of concocting the proper Find & Replace expressions. You might do best by looking at the PowerFind (Pro) part of the manual if you need help on this. That said I can give you a few solutions.

If your data is always exactly the same form then a simple Find & Replace would be best:

Code: Select all

Find and Replace 'Last: (.+)\nFirst: (.+)', '\1\t\2', 'E'
A more generalized solution that would process any form, regardless of the property names, would require a more complicated macro:

Code: Select all

$count = 0

# visit all named form properties
While Find ‘.+?: ’, ‘E’
    Delete # delete property name
    $count += 1
    # insert value delimiter
    Find ‘\n|$’, ‘E’
    Insert Text “\t”

# warn about failure or delete the final tab
If $count == 0
    Prompt ‘Found no form property name/value pairs in the document.’