selecting between markers

Get help using and writing Nisus Writer Pro macros.
Post Reply
Posts: 2
Joined: 2003-08-25 07:22:56

selecting between markers

Post 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.

User avatar
Official Nisus Person
Posts: 4874
Joined: 2002-07-11 17:14:10
Location: San Diego, CA

Post 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.’

Post Reply