Januk [J],
On 10-11-2003 05:27, you wrote in <mid:[EMAIL PROTECTED]>:
J> That's because the address regexps can't handle the colon after the
J> labels in the second example. There are a couple of other errors
J> too. Try the following (note: I haven't tested this much, so it may
J> need polishing):
I works better now.
The Post code (POSTNR) thing needs a bit of tweaking (it returns an
empty string), but I think I can manage that myself.
I'm in greater trouble concerning the FRAGTMOMSFRI or FRAGTMOMSPLIGTIGT.
This string is also empty.
J> =====[Begin template fragment]===== %Rem=" Get Name and address from
J> Billing Address "%- %-
I have wrapped this for readability reasons:
J> %SetPattRegexp="(?im-s)^(Billing\sAddress|Fakturaadresse)
J> [^\n]*?\n-{50,}\s*?\n(.*?)\s*?\n((.*?)\s*?\n)?((.*?)\s*?\n)?((.*?)\s*?\n)?
J> ((\D{1,2}.\d{3,6})|\d{3,6})\s(.*?)\s*\n\s*(.*?)\s*?\n"
This last line is for the post code, right? I guess the missing string
stems from the problem with spaces in the possibilities, right?
Possible post codes:
5678
N-5678
S-23 456
S-345 56
SE-234 56
SE-45 456
- each followed by a space and a non-integer character.
J> %RegexpBlindMatch="%Text"%-
What does this line do? Does it say where to "extract" the result from?
J> %_Shipping='%SetPattRegexp="(?im-s)shipping.*?(\d*([\.\,]d*)?)dkk\s*\n"%-
J> %___________%RegexpMatch="%Text"'%-
J> %-
J> %If:'%RegexpText="(?im-s)^Total:.*\n\s*?(Moms|DK\smoms\/VAT)\n\n"'<>'':'%-
J> FRAGTMOMSPLIGTIGT=%Calc="%_Shipping*0.8"dkk':'%-
J> FRAGTMOMSFRI=%_Shipping'
This is wrong. Although the string "DK moms/VAT:" is present the pure
number is returned and it is set to FRAGTMOMSFRI (without *0,8)
PF>> As I don't really understand how you make sub-patterns and variables
PF>> it's a bit hard for me to change your code.
J> Subpatterns are simply parts of the regexp surrounded by round
J> brackets. Counting them is also very easy, just count the number of
J> opening brackets.
... and they are numbered sequentially?
J> I actually used a fair bit of what you wrote, just combined it and
J> cleaned some of it up a bit. But you had done quite a bit of the
J> logic. So hang in there, look for things that look similar to yours
J> and go from there.
Any hint as to recursive element for the goods which are each instance
is preceded by <varer>?
--
<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