Some things i would like to do:
define delimiter fontBlock as "<font" && a string header &">"\
& a string body &"</font>"
get the header of the fifth fontBlock of ...
get word 1 of the body of fontBlock 3 of ...
define delimiter headerAttribute as a token name &"="& a token value
-- remember tokens can contain spaces if it is in quotes
repeat for each headerAttribute a in fontBlock 3 of ...
switch the name of a
case ...
And we could even define sub item types.
define delimiter block as "<" & a word type & a string header &">"\
& a string body & "</"& the type &">"
define delimiter fontBlock as a block where type is "font"
...
I know this is very much to ask for, but i think it would make it a
hell lot easier to parse xml et.al.
get "a,b,c,d"&cr&"aa,bb,cc,dd"&cr&"aaa,bbb,c,ddd"
match "c" in item 3 of each line of it
get the matchingLineNumbers --> "1,3"
get the matchingLines --> "a,b,c,d"&cr&"aaa,bbb,c,ddd"
I think it is better to use "match" or maybe "search" instead of
"find", because find is used for finding in fields.
repeat for each line L in it matching "c" in item 3
...
I understand that this sounds easier than it actually is. The
question <[EMAIL PROTECTED]> asked is a very important issue:
>Hmmm... before opening my mouth about possibility, let me ask what the
>result of:
>
> find "hello" & a string matched & "world" in "hello, hello world
>world!"
>
>is.
>
>Is it ", hello " or ", hello world"?
>
>Must a match match the entire "in ..." part? Or should substring amtches be
>allowed? Does "a string" eat as few or as many characters as
>possible? Is backtracking required?
The standard for regexp is all-you-can-eat. For html, xml, et.al. the
start and end blocks must match... they are allowed to stack, but
they must match. Or take parentheses:
define delimiter par as "(" & a string body & ")"
get par 3 of "a(b(c(d)c)b)a" --> "d"
get par 2 of "a(b(c(d)c)b)a" --> "c(d)c"
get par 1 of "a(b(c(d)c)b)a" --> "b(c(d)c)b"
but
matchText("a(b(c(d)c)b)a",".*(\(.*\)).*",a)
returns
"(d)c)b)"
So we need something more intelligent than regexp, don't we?
Regards
R�diger
P.S.: Two things i'd like to see in xTalk that are not worth their own thread:
1. "the ms" as an abbreviation of "the milliseconds"
2. MetaCard has call-by-reference, but you can not see that in the
call. One of the great things about C is that you see in the call
that this variable is to be changed. How about adding the "@" to the
call as well?
--------------------------------------------------------------------
| Ruediger zu Dohna GINIT GmbH 0721-96681-63 [EMAIL PROTECTED] |
| PGP-Fingerprint: F1 BF 9D 95 57 26 48 42 FE F8 E8 02 41 1A EE 3E |
--------------------------------------------------------------------