nisus.com
https://www.nisus.com/forum/

selecting between markers
https://www.nisus.com/forum/viewtopic.php?f=17&t=2732
Page 1 of 1

Author:  danbond [ 2008-01-05 17:47:44 ]
Post subject:  selecting between markers

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

What I need:
data1<tab>data2 etc.

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

Thanks for your help.

Author:  martin [ 2008-01-07 06:29:17 ]
Post subject: 

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:
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:
$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”
End

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

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/