[REBOL] Re: Help with parsing
From: wild::orca::btinternet::com at: 7-May-2001 19:35
Brett
Thanks for taking the time to helping me understand Rebol parsing. I have
made some minor modifications to the function that you created for me and
now it does exactly what I need it to. Even better I now have a much greater
understanding of parsing.
The function now looks like this
result-dates: function [
"Returns the dates after a specified event name"
data
event-name
] [parse-rule result date-rule digit mon-abbrev found] [
digit: charset [#"0" - #"9"]
mon-abbrev: ["jan" | "feb" | "mar" | "apr" | "may" | "jun" | "jul" |
"aug" | "sep" | "oct" | "nov" | "dec"]
date-rule: [1 2 digit #"-" mon-abbrev #"-" 2 digit]
parse-rule: [
any [
copy current-date date-rule (if found = event-name [append
result to-date current-date]) |
copy found event-name |
skip ; ignore one character
]
end
]
result: copy []
either parse data parse-rule [RETURN result] [RETURN none]
]
The function returns each date in the row that immediately follows the
event-name
Thanks
Stephen