OK, I downloaded a visual RegExp tool, but there is still a long way
to go before I can do this myself.

Could anybody please help me?

On 30-10-2003 15:33, I [P] wrote in <mid:[EMAIL PROTECTED]>:
P> =========================================================================

P> dk.tech.gear
P> ------------------------------------------------------
P> Order Number: (Order number)
P> Detailed Invoice#1: (Url to our web site with order details)
P> Date Ordered#2: [The order date] {1}

I have figured this out: In the template for saving the file I have made
it so the date is saved in YYYYMMDD. It can be extracted with
[The order date] = (^Date:\s{4}).{8}

P> [Multi-line comment field, including blank lines, that may or may not be
P> there]

This poses a problem. It could look like this:

============================================================================
------------------------------------------------------
Ordrenummer: (some Number)
Detaljeret faktura: (some Number)
Ordre modtaget:  mandag 14 juli, 2003

Er jeg for sent ute til å benytte tilbudspris (fra nyhetsmail) på jetfin ?

Kan dere sende meg en mail med pris, slik at jeg får overført penger.

Per

Produkter:
------------------------------------------------------
============================================================================

P> Products#3
P> ------------------------------------------------------
P> [Number ordered] x Single tank adapter ([Item model name]) = 280dkk

I have:
[Number ordered] = ^\d+(\sx\s)
[Item model name] = (\d{1,2}\sx\s.+)(\s\().+(\)\s)

P> ------------------------------------------------------
P> Sub-Total#4: 3.640dkk
P> [Shipping method] (Shipping (5-7 days) to NO : 9.72 kg): [Shipping
P> Price]

[Shipping method] = (Sub(-Total|total).+\n).+(\s\(\(D+)
[Shipping Price] = (Sub(-Total|total).+\n)(.*:\s).+(dkk$)

P> Total: 3.865dkk
P> {3}

How can I test for the text strings "Moms" or "DK moms/VAT" at the
position {3} and use that later?

P> Delivery Address#5
P> ------------------------------------------------------
P> [Delivery Name]

= (Delivery Address|Leveringsadresse)(.*\n)(-+\n)^.+

P> [Delivery Address]

= (Delivery Address|Leveringsadresse)(.*\n)(-+\n)(^.+\n)^.+

P> [Delivery Address2, if applicable]

= (Delivery Address|Leveringsadresse)(.*\n)(-+\n)(^.+\n)(^.+\n)^.+

P> [Delivery Address3, if applicable]

I don't know how to end the extraction of these addresses - how many of
them are there are and stop at the right time. I suspect that I can use
the Delivery Post Code as a stop clause, but how to do this, i.e. the
recursive element escapes me.

P> [Delivery Post code]{4}

= (\n)\D{1,2}.\d{3,6}(\s)|(\n)\d{3,6}(\s) - except I have a problem
here. This will not find "SE-123 23". Can anybody help?

P>  [Delivery City]

= ((\n)\D{1,2}-\d{3,6}(\s)|(\n)\d{3,6}(\s))

P> [Delivery country]

= ((\n)\D{1,2}-\d{3,6}(\s)|(\n)\d{3,6}(\s))

P> Billing Address#6
P> ------------------------------------------------------
P> [Name]

= (Billing Address|Fakturaadresse)(.*\n)(-+\n)^.+

P> [Address]

= (Billing Address|Fakturaadresse)(.*\n)(-+\n)(^.+\n)^.+

P> [Address2, if applicable]

= (Billing Address|Fakturaadresse)(.*\n)(-+\n)(^.+\n)(^.+\n)^.+

P> [Address3, if applicable]

(same problem as above finding out when to end)

P> [Post code]{4} [City]
P> [Country]

These need to be distinguished from the ones above.


P> Payment Method
P> ------------------------------------------------------
P> Money Order/Cheque (in DKK)

P> (Some text that can be disregarded)

P> EOF

P> =========================================================================

(snip)

P> {2} This is a number ending with dkk, "160dkk". See below as this
P> probably presents the largest issue with formatting after extracting it.

P> {3} There there may be a text string "Moms" or "DK moms/VAT". It is
P> always followed by 1 empty line. Whether this line is here is very
P> important for {2} above and the formatting of the output.

P> {4} Typical format is 4 digits, but may also be (country code-a number
P> of digits): S-123 34. It is always followed by a space and then the
P> city.

P> I would like to format the extracted stuff thus (there should be no
P> [ ]'s):

I don't know how to make a QT that takes the RegExp above and saves it
in variables so it can be formatted as below.

In other words - I need the "shell" for all my little extractions - the
main QT that handles all of this.

P> Notes in { }

P> =========================================================================

P> <ORDRE>
P> ORDREDATO=[The order date, in the form YYYYMMDD]

P> KUNDENR=[Random generated string, max 10 characters, may be left out]

P> NAVN=[Name]

P> ADRESSE1=[Address]

P> ADRESSE2=[Address2, if applicable]

P> ADRESSE3=[Address3, if applicable]

P> POSTNR=[Post code]

P> BYNAVN=[City]

P> LAND=[Country]

P> LEV:NAVN=[Delivery Name]

P> LEV:ADRESSE1=[Delivery Address]

P> LEV:ADRESSE2=[Delivery Address2, if applicable]

P> LEV:ADRESSE3=[Delivery Address3, if applicable]

P> LEV:POSTNR=[Delivery Post code]

P> LEV:BYNAVN=[Delivery City]

P> LEV:LAND=[Delivery country]

P> MOMSBEREGNING=DK {This should be fixed as "DK"}

P> VEDRØRENDE=[Multi-line comment field, including blank lines, that
P> may or may not be there]

P> LEVERING=[Shipping method]

P> BETALINGSMETODE=For {This should be fixed as "For".}



P> FRAGTMOMSFRI=[Shipping Price]       {If the strings in {3} above are  }
P> FRAGTMOMSPLIGTIGT=[Shipping Price]  {present, then [Shipping Price]   }
P>                                     {should be preceded by       
P>                                     {"FRAGTMOMSPLIGTIGT", except the  }
P>                                     {[Shipping Price] number should be}
P>                                     {the _extracted_ [Shipping Price] }
P>                                     {number multiplied by 0.8!   
P>                                     {If not present, it should be
P>                                     {preceded by "FRAGTMOMSFRI"  
P>                                     {without recalculation. I.e. 
P>                                     {_only_ one of the lines.     }

This is a problem. How do I make a statement:

     If "Moms" or "DK moms/VAT" is present in the order
     Then make a FRAGTMOMSPLIGTIG=X, and let X be 0.8*[Shipping
     Price] 1)

     If "Moms" or "DK moms/VAT" is NOT present in the order
     Then make a FRAGTMOMSFRI=[Shipping Price] 1)

     1) "(Sub(-Total|total).+\n)(.*:\s).+(dkk$)"

P> <VARE>
P> ANTAL=[Number ordered]

P> VARENUMMER=[Item model name]

How do I generate a <VARE> with ANTAL=^\d+(\sx\s) and
VARENUMMER=(\d{1,2}\sx\s.+)(\s\().+(\)\s) for each instance of ANTAL?

Also I need to be able to distinguish the different orders in the mail.
I need to format each <ORDRE> within the scope of each mail saved to
disc: these can be limited by ===-===-===... to start each mail and
---=---=--- to end each mail - and consequently <ORDRE>. How do I do
that?

P> <VARE>
P> ANTAL=[Number ordered]

P> VARENUMMER=[Item model name]

P> {and so on for all lines of goods}

P> =========================================================================

I am very proud of myself for having reached so far - the visual RegExp
3.0 really helps, but now I am probably at my wits' end - please
somebody help me!

TIA.

-- 
<greeting> Best regards </greeting>
<author> Peter Fjelsten </author>
<thebat version> 2.01.15 </thebat version>
<os> Windows XP 5.1.2600 </os>




________________________________________________________

http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to