[REBOL] Re: Help required for a little parsing problem
From: al:bri:xtra at: 19-Nov-2000 9:42
Nigel wrote:
> Whilst I could probably write a (long) solution I'm sure there must be an
elegant couple of line Rebol solution - one problem is that there may be any
number of links in the post.
Process: function [String [string!]
][
UrlStart Url UrlEnd
][
parse String [
any [
to "[url]" UrlStart: thru "[url]" copy Url to "[/url]" thru
[/url]
UrlEnd: (
change/part UrlStart rejoin [
"" join <a> [
{ href="} Url {" target="_blank"}
] Url</a>
] UrlEnd
)
] to end
]
String
]
BulletinBoard: Process Post
Andrew Martin
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
-><-
All on one line (Caution: Line may be broken by email):
Process: function [String [string!]][UrlStart Url UrlEnd][parse String [any
[to "[url]" UrlStart: thru "[url]" copy Url to "[/url]" thru "[/url]"
UrlEnd: (change/part UrlStart rejoin ["" join <a> [{ href="} Url {"
target="_blank"}]Url</a>] UrlEnd)]to end]String]