Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Newbie parsing problem (cont'd)

From: richard:coffre:francetelecom at: 2-Apr-2002 13:25

Thanks it works well -----Message d'origine----- De : Gregg Irwin [mailto:[greggirwin--mindspring--com]] Envoy=E9 : vendredi 29 mars 2002 20:17 =C0 : [rebol-list--rebol--com] Objet : [REBOL] Re: Newbie parsing problem (cont'd) 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