OK, I'll give you a simple solution for a subset of your problem, from there you can probably expand easily.
Ff: parse fcontents " " Foreach [date s1 s2 money status] ff [ ;first we'll have to convert the date month: copy/part date 2 day: copy/part at date 4 2 year: copy/part at date 7 2 new-date: to-date rejoin [ day "-" month "-" year ] ; Now we can construct a block probe reduce [ new-date rejoin [s1 " " s2] to-money money status ] ] However.... this assumes that the optional string (pending) is always there. Using a bnf rule with parse/all will get you further. This will take some experimenting based on the exact format. Another strategy could be to first replace all dates with valid date formats (for REBOL that is, swapping day and month), then converting your date to a block and then parse based on REBOL types, which makes matching much easier. You may want to take a look at the parse section of the user guide. --Maarten > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of > Mike Weber > Sent: donderdag 2 oktober 2003 6:21 > To: [EMAIL PROTECTED] > Subject: [REBOL] Rebol parsing 101 > > im brand new to Rebol and not getting the hang of string parsing > > for example: assume i have string > fcontents > == {09/29/03 ATM/POS ACTIVITY $28.68 (pending) 09/29/03 ATM/POS ACTIVITY > $11.41 09/29/03 ATM/POS ACTIVITY $ > 21.71 ... > > i would like to convert this string into a set of blocks where each block > has 4 elements of the types [date string money string] (the 4th element is > optional > [09/29/03 "ATM/POS ACTIVITY" $28.68 (pending)] > [09/29/03 "ATM/POS ACTIVITY" $11.41 ] > [09/29/03 "ATM/POS ACTIVITY" $21.71 ] > > > i've been plodding around trying to get anything to work, like > > find/any fcontents ["09/*/03"] > > but im not understanding how to isolate the elements > > i suspect i should be able to create something akin to a regular expresion > that i can use as a pattern to apply to the string > > > > -- > To unsubscribe from this list, just send an email to > [EMAIL PROTECTED] with unsubscribe as the subject. -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
