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

[REBOL] Re: Parse

From: brett::codeconscious::com at: 8-Mar-2001 11:28

Hi Bill, I'm sorry, I can't work out what you are trying to achive here. The rules area-code and phone-num cannot be satisfied by the data you have presented in str - or is that the point? Can you provide a bit more information on what exactly you are trying to do. However taking a stab at something that might help... The data you have in str appears like it might be PABX records - if the records are identical in structure it might be easier to tream them a line at a time. For example you could read them in with block-of-lines: read/lines %pabx-data.dat Then you get a block of lines. Equivalently using your existing data block-of-lines: parse/all str "^/" Playing with each line individually
>> parse second block-of-lines none
== ["28/11/00" "27.13" "28.00" "26.81" "27.81" "+0.93" "2668900"] Maybe you know that phone-number will always be the 7th field in the record, so...
>> pick (parse second block-of-lines none) 7
== "2668900" Cheers, Brett.