Januk [J],
On 05-11-2003 05:17, you wrote in <mid:[EMAIL PROTECTED]>:
PF>> Something is halting the output as only the fixed text is output,
PF>> i.e. the "NAVN=", etc.
J> This is when you try it in TB? Which type of template are you using?
I have tried putting your template into the sorting office, where the
resultant file is exported to a text file.
It's the strangest thing: for some orders, it works 85% on for others
only 10% - although there are more that works 10% than 85%.
As I don't really understand how you make sub-patterns and variables
it's a bit hard for me to change your code.
You use completely different (and probably much better) RegExp then me
but it's at a different level then me which makes it hard to understand.
Below, I've included some good and bad versions for your information.
GOOD ONE
=====================================================================
dk.tech.gear
------------------------------------------------------
Order Number: 575
Detailed Invoice: (URL)
Date Ordered: Friday 10 October, 2003
Products
------------------------------------------------------
1 x Single tank adapter (DK-Enkel) = 280dkk
1 x Wetnotes pages (DTD-WetnotesP) = 100dkk
1 x Combo (Backplate, harness & crotch strap) (DK-Combo) = 1.040dkk
1 x Wetnotes pouch (DTD-WetnotesL) = 80dkk
1 x 4,5 Amp canister light (DTD-Prim�r4) = 6.080dkk
1 x MOD set: deco (DTD-DekoK) = 40dkk
------------------------------------------------------
Sub-Total: 7.620dkk
Danish Postal Service (Shipping (5-7 days) to NO : 10.314 kg): 255dkk
Total: 7.875dkk
Delivery Address
------------------------------------------------------
Vidar Vardvik
Helletoppveien 6
N-4810 Eydehavn
Norway
Billing Address
------------------------------------------------------
Vidar Vardvik
Helletoppveien 6
N-4810 Eydehavn
Norway
(...)
000000000000000000000000000000000000000000000000000000000000000000000
<ORDRE>
NAVN=Vidar Vardvik
ADRESSE1=Helletoppveien 6
ADRESSE2=
ADRESSE3=
POSTNR=N-4810
BYNAVN=Eydehavn
LAND=Norway
LEV:NAVN=Vidar Vardvik
LEV:ADRESSE1=Helletoppveien 6
LEV:ADRESSE2=
LEV:ADRESSE3=
LEV:POSTNR=N-4810
LEV:BYNAVN=Eydehavn
LEV:LAND=Norway
MOMSBEREGNING=DK
VEDR0REND=
LEVERING=Danish Postal Service (Shipping (5-7 days) to NO : 10.314 kg): 255dkk
BETALINGSMETODE=For
FRAGTMOMSFRI=255
=====================================================================
Of course the "LEVERING" should be only "Danish Postal Service", i.e. up
to the first space before the "(" - which is always there - but apart
from that: P_E_R_F_E_C_T!
BAD ONE
=====================================================================
dk.tech.gear
------------------------------------------------------
Ordrenummer: 511
Detaljeret faktura: (URL)
Ordre modtaget: onsdag 09 juli, 2003
Produkter:
------------------------------------------------------
1 x Flaskeb�nd: 15/18/20L (V4T-204) = 1.100dkk
3 x Ventilknopper (SH-VKnop) = 240dkk
------------------------------------------------------
Subtotal: 1.340dkk
PostDanmark (Levering (tager 5-7 dage) til DK : 3.9 kg): 82dkk
Total: 1.422dkk
Moms: 284dkk
Leveringsadresse:
------------------------------------------------------
GHS-DYK
Glenn Schmidt
Fan�vej 10
7680 Thybor�n
Denmark
Fakturaadresse:
------------------------------------------------------
GHS-DYK
Glenn Schmidt
Fan�vej 10
7680 Thybor�n
Denmark
(...)
000000000000000000000000000000000000000000000000000000000000000000000
<ORDRE>
NAVN=
ADRESSE1=
ADRESSE2=
ADRESSE3=
POSTNR=
BYNAVN=
LAND=
LEV:NAVN=
LEV:ADRESSE1=
LEV:ADRESSE2=
LEV:ADRESSE3=
LEV:POSTNR=
LEV:BYNAVN=
LEV:LAND=
MOMSBEREGNING=DK
VEDR0REND=
LEVERING=PostDanmark (Levering (tager 5-7 dage) til DK : 3.9 kg): 82dkk
BETALINGSMETODE=For
FRAGTMOMSFRI=
=====================================================================
Not only is nothing extracted, but the the shipping price is not
calculated right: The "moms" is not picked up and the wrong type is set
(should be FRAGTMOMSPLIGTIG) and the number should be 65,6 (note the ,
and not a . )
ISSUE WITH POST CODE EXTRACTION
=====================================================================
Delivery Address
------------------------------------------------------
Alexander Andersson
Regeringsgatan 56A
374 35 Karlshamn
Sweden
000000000000000000000000000000000000000000000000000000000000000000000
LEV:POSTNR=
LEV:BYNAVN=35 Karlshamn
=====================================================================
Here the Swedish post code ("374 35") causes the integers not to be
matched.
The comments field* is the only one that always works.
,----- [ * ]
|
| VEDR0REND=%SetPattRegexp="(?ism)^(Date Ordered|Ordre
modtaget):[^\n]*\n\s*(.*?)\s*\n(Products|Produkter):"%-
| %_________%RegexpBlindMatch="%Text"%-
| %_________%SubPatt("2")
`-----
PF>> My problem is that when I load it into my RegExp tester it says
PF>> "Couldn't compile regular expression pattern: quantifier operand
PF>> invalid".
J> Well, your regexp tester might not use the same implementation for
J> regexps as TB.
That's probably the reason - which makes it extra hard for a RegExp
loser like me to iron out any bugs.
J> Internal option setting. See the help file under:
J> |->Contents
J> |->Advanced Usage Topics
J> |-> Regular Expressions
J> |-> Regular Expression Syntax (Advanced)
J> |-> Internal Option Setting
OK, thanks.
J> %RegexpText is a shortcut. If subpattern 1 is defined, that's what
J> is returned, otherwise subpattern 0 is returned.
OK. I thought so.
PF>> This seems to return "FRAGTMOMSFRI=" no matter what I test it on?
J> In a QT? Maybe there is some whitespace before after the Moms string.
J> Try adding \s*? between the "VAT)" and the "\n\n".
I'm afraid this isn't the case. I have tried.
PF>> Maybe I should test this by cutting it up and using it as QTs?
J> Definitely.
This is what I've done... :)
Thank you for your help!
--
<greeting> Best regards </greeting>
<author> Peter Fjelsten </author>
<thebat version> 2.01.20 </thebat version>
<os> Windows XP 5.1.2600 </os>
________________________________________________________
http://www.silverstones.com/thebat/TBUDLInfo.html