Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Parse limitation ?

From: patrick::philipot::laposte::net at: 8-Oct-2003 12:10

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. For example, a text from which I want to extract the HREF and the SRC target. myText: {<A HREF="#section1"><IMG SRC="foobar.gif"><A HREF="#section1">} parse myText [ any [ thru "HREF=" copy target to ">" (print target) | thru "SRC=" copy target to ">" (print target) ] ; any ] ; parse #section1 #section1 parse myText [ any [ thru "SRC=" copy target to ">" (print target) | thru "HREF=" copy target to ">" (print target) ] ; any ] ; parse foobar.gif #section1 The result is different depending which rule comes first. The only way I see as a workaround is to parse the text twice. Is there a better (smarter) way? Regards Patrick