[REBOL] Help on parsing
From: gchillemi:aliceposta:it at: 13-Mar-2004 16:25
Hi,
I am a newbie to Rebol. I need a little help on parsing:
I have these 2 possible inputs:
1) "KW1 555 <br> KW1 333 KW2 444 <br>"
2) "KW1 555 KW2 666 <br> KW2 444 <br>"
I need to extract the value of KW1 and KW2 , or KW1 itself.
If I parse using (1):
any[[to "KW1" copy myresult to <br>] | [to "KW1" to "KW2" copy myresult2 to
<br>]]
(1) is parsed correctly by the first block of the rule but (2) is not (and
the reason is clear)
If I exchange the blocks of the rule, changing block1 to block2 and vice
versa the result is still wrong because
any[[to "KW1" to "KW2" copy myresult2 to <br>] | [to "KW1" copy myresult to
<br>]]
Will parse string (2) correctly but string (1)
KW1 555 <br> KW1 333 KW2 444 <br>
Is parsed from the value of the first KW1 to KW2 (which is not a piece of
the first part !) and finally to <br>
Thank you in advance for you answers !
Giuseppe Chillemi