[REBOL] Re: Newbie parsing problem (cont'd)
From: greggirwin:mindspring at: 29-Mar-2002 12:17
Hi Richard,
<< I have a file containing data as below :
GetActiveAccounts:request = activeaccounts
GetTransactions:request = ocodereview
CancelAccount:request = cancelacc
In my code, I try to catch everything before ":request"...>>
I think PARSE is one of REBOL's greatest features, but for simple splitting
there are other options as well, which are sometimes a little more
straight-forward. I don't know if this will suit your needs, but it shows
how you can use FIND and COPY/PART to do what you want. It should be easily
generalized as well.
data: [
{GetActiveAccounts:request = activeaccounts}
{GetTransactions:request = ocodereview}
{Shouldn't see this:no match here = invalid record}
{CancelAccount:request = cancelacc}
]
foreach item data [
if loc: find item ":request" [
print copy/part item subtract index? loc 1
]
]
HTH!
--Gregg