[REBOL] Re: A little parse help
From: petr::krenzelok::trz::cz at: 20-Aug-2001 9:42
Stefan Falk wrote:
> Hi,
> I'm kinda tired today ;-)
>
> If I for example have this text:
>
> Quick brown fox jumps !image-brown.gif over the fence
>
> and I want to parse out the image file, I'll just do
> parse text [ any [ thru "!" copy wanted-text to " " ]]
1) I think that even your parse rule above is not ever met. 'parse, by default,
ommits spaces, so you would be probably better with parse/all here.
2) I don't know your application, but wouldn't you would be better with 'find?
e.g.
->> start: find/any str "!*.???"
== "!image-brown.gif over the fence"
->> end: find start " "
== " over the fence"
->> res: copy/part start end
== "!image-brown.gif"
->> remove res
== "image-brown.gif"
->>
If your string is long, you can reassing its position in a loop, e.g. "str:
end" and continue in searching another image ... Maybe not so elegant, but ...
-pekr-