[REBOL] Re: Parse limitation ?
From: patrick:philipot:laposte at: 8-Oct-2003 21:01
Hello Ingo,
Wednesday, October 8, 2003, 12:50:20 PM, you wrote:
IH> Hi Patrick,
IH> patrick à la poste wrote:
>> Hi List,
>>
>> I'd like to parse a string searching for two things at the same time.
>> it seems to me that this is impossible.
IH> One trick is, to find something that is equal between the two strings, and
IH> work from there ...
IH> REBOL []
IH> myText: {<A HREF="#section1"><IMG SRC="foobar.gif"><A HREF="#section2">}
IH> parse/all myText [
IH> any [
IH> to "=" here: (there: at here -4) :there [
IH> [ "HREF=" | " SRC=" ]
copy target to ">>" (print target) |
IH> thru "="
IH> ]
IH> ]
IH> ] ; parse
IH> In this example I used the "=" which is common to both strings, checked
IH> whether what I have _before_ this sign is one of the two strings I'm
IH> interested in, and then start to copy, or just go thru the "=" to start
IH> again ...
IH> I hope that helps,
IH> Ingo
This is brilliant!
Thank you Ingo.
--
Best regards,
Patrick