Januk [J], Sorry for replying late but I've just stated a new job this Monday (usability engineer), so it's a bit hectic for me... :)
On 03-11-2003 01:45, you wrote in <mid:[EMAIL PROTECTED]>: J> Ok, I've got most of it, though perhaps not the hardest parts. This J> is partially tested, but you'll have to see if it actually works. Er, it doesn't really. Something is halting the output as only the fixed text is output, i.e. the "NAVN=", etc. Please see comments below: J> =====[Begin template fragment]===== J> %Rem=" Get Name and address from Billing Address "%- J> %- J> %SetPattRegexp="(?im-s)^(Billing\sAddress|Fakturaadresse)\s*?\n-{50,}\s*?\n(.*?)\s*?\n((.*?)\s*?\n)?((.*?)\s*?\n)?((.*?)\s*?\n)?((\D{1,2}.\d{3,6})|\d{3,6})\s(.*?)\s*\n\s*(.*?)\s*?\n" My problem is that when I load it into my RegExp tester it says "Couldn't compile regular expression pattern: quantifier operand invalid". So it's hard for me to test here. If I remove "(?im-s)" it will compile some places. If I remove "(?im-s)" the following is matched: 1: Billing Address X: ------------------------------------------------------ 2: Vidar Vardvik 3: Helletoppveien 6 4: N-4810 X: Eydehavn X: Norway The X's are all matched by the same part (according to the RegExp-tester): same colour in the "result window", and the colour is the one for "match" - and other parts are for the different types of "sub pattern match". It appears to match until Post code is listed at the fifth position. J> %RegexpBlindMatch="%Text"%- J> NAVN=%SubPatt("2") J> ADRESSE1=%SubPatt("4") J> ADRESSE2=%SubPatt("6") J> ADRESSE3=%SubPatt("8") J> POSTNR=%SubPatt("10") J> BYNAVN=%SubPatt("11") J> LAND=%SubPatt("12") J> %Rem=" Get Name and address from Delivery Address "%- J> %- J> %SetPattRegexp="(?im-s)^(Delivery\sAddress|Leveringsadresse)\s*?\n-{50,}\s*?\n(.*?)\s*?\n((.*?)\s*?\n)?((.*?)\s*?\n)?((.*?)\s*?\n)?((\D{1,2}.\d{3,6})|\d{3,6})\s(.*?)\s*\n\s*(.*?)\s*?\n" The same here as above. J> LEV:ADRESSE1=%SubPatt("4") J> LEV:ADRESSE2=%SubPatt("6") J> LEV:ADRESSE3=%SubPatt("8") J> LEV:POSTNR=%SubPatt("10") J> LEV:BYNAVN=%SubPatt("11") J> LEV:LAND=%SubPatt("12") J> MOMSBEREGNING=DK J> VEDR0REND=%SetPattRegexp="(?ism)^(Date Ordered|Ordre J> modtaget):[^\n]*\n\s*(.*?)\s*\n(Products|Produkter):"%- J> %_________%RegexpBlindMatch="%Text"%- J> %_________%SubPatt("2") Maybe it's just me who don't really understand this, but here the tester doesn't complain about "(?im-s)"... What _is_ (?im-s)? What does it do? J> LEVERING=%RegexpText="(?im-s)^Sub-?total:.*?\n\s*?(.*)\s*?\n" If I remove (?im-s), the "^Sub-?total:.*?\n\s*?(.*)\s*?\n" matches. OK, now I get it: the RegExp tester sets the 'main match' as the one not in parantheses. TB can do it better and decide which one of the sub-patterns is the important one? J> BETALINGSMETODE=For J> %_Shipping='%SetPattRegexp="(?im-s)shipping.*?(\d*([\.\,]d*)?)dkk\s*\n"%- J> %___________%RegexpMatch="%Text"'%- J> %- J> %If:'%SetPattRegexp="(?im-s)^Total:.*\n\s*?(Moms|DK\smoms/VAT)\n\n"'<>'':'%- J> FRAGTMOMSPLIGTIGT=%Calc="%_Shipping*0.8"dkk':'%- J> FRAGTMOMSFRI=%_Shipping' This seems to return "FRAGTMOMSFRI=" no matter what I test it on? Maybe I should test this by cutting it up and using it as QTs? T H A N K Y O U. -- <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