[REBOL] Re: Parse limitation ?
From: greggirwin:mindspring at: 8-Oct-2003 12:03
Hi Patrick,
pālp> I'd like to parse a string searching for two things at the same time.
pālp> it seems to me that this is impossible.
...
pālp> parse myText [
pālp> any [ thru "HREF=" copy target to ">" (print target) |
pālp> thru "SRC=" copy target to ">" (print target)
pālp> ] ; any
pālp> ] ; parse
I'm pretty sure this same thing came up not too long ago on the list.
See if rebol.net/list has it, or if you've been around for at least a
couple months, you should have it too (the solution that is). If you
can't find it, let me know and I'll see if I can dig it up.
The issue has to do with wanting the THRU rule to be smarter than it
is. PARSE doesn't do backtracking, so it will keep going forward
until it finds the next occurrence of the first rule you give it,
which isn't what you want, but it isn't wrong either. :)
-- Gregg