[REBOL] Re: Using parse to make intelligent substitutions.
From: mat::plothatching::com at: 28-Apr-2003 16:54
Hello Mat,
MB> Here's my stab;
And of course a few minutes later (and about half as long as it takes
mails to get posted on the list) I work out how to use 'some digits'.
:)
So here's my revised go, this time I'll make a function;
replaceblogstr: func [
inputtext
/local digits blogsfound foundblog
][
digits: charset "0123456789"
blogsfound: copy []
parse inputtext [any [thru "blog" copy foundblog some digits (append blogsfound to-integer
trim foundblog)]]
foreach foundblog blogsfound [
replace InputText rejoin["blog "foundblog] rejoin[{<A HREF="http://www.blah.com/blog.php?blog=}foundblog{">blog
}foundblog{</A>}]
]
InputText
]
Much less sucky! Is that as good as it can get?
Regards,
Mat Bettinson - +44-(0)20-83401514.