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

[REBOL] Re: Help required for a little parsing problem

From: christian:ensel:gmx at: 18-Nov-2000 21:37

Hello Nigel,
> 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.
I'm not sure whether it's elegant :) At least it's a couple of lines and does the trick for multiple occurences of [url]...[/url] brackets: ;------------------------------------------------ post: { This is a post - Perl is good [url]http://www.perl.com[/url], Rebol is better [url]http://www.rebol.com[/url]! This is a post - Perl is good [url]http://www.perl.com[/url], Rebol is better [url]http://www.rebol.com[/url]! This is a post - Perl is good [url]http://www.perl.com[/url], Rebol is better [url]http://www.rebol.com[/url]! } parse post [ any [ to "[url]" tag: 5 skip copy url to "[/url]" ( remove/part tag add length? url 11 insert tag rejoin [ {<a href="} url {" target="_blank">} url {</a>} ] ) ] to end ] ;------------------------------------------------ Hope this helps, Christian [Christian--Ensel--GMX--De]