parsing - Best way to parse this in Rebol -
how extract transaction receipt datetime least bit of noise in parse rule following html? (the output i'm looking this: "transaction receipt: 04/28/2011 17:03:09")
<font color=darkblue>transaction receipt </font></th></tr><tr></tr><tr></tr><tr><td colspan=4 align=center><font size=-1 color=darkblue>04/28/2011 17:03:09</font>
the following works don't feeling! there guaranteed datetime following words transaction receipt somewhere (although wouldn't greedy match if i'm doing grep)
parse d [ thru {<font color=darkblue>transaction receipt </font></th></tr><tr></tr><tr></tr><tr><td colspan=4 align=center><font size=-1 color=darkblue>} copy t "</font>" ]
this shorter...
parse d [thru <font size=-1 color=darkblue> copy t </font>]
but isn't looking datetime pair. , unfortunately rebol considers date used invalid one...
>> 04/28/2011 ** syntax error: invalid date -- 04/28/2011 ** near: (line 1) 04/28/2011
so can't search specifically. if date 28/04/2011 (and there space after time, though why it's needed load i'm not sure), following work...
parse load d [to date! copy t </font>]
hmmm. try this...
t: "" parse d [ [ "<" thru ">" mark: copy text "<" (if text [append t text]) :mark ] ]
that returns: "transaction receipt 04/28/2011 17:03:09"
it works skipping tags, appending text that's left t.
hope helps!
Comments
Post a Comment