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

[REBOL] Re: Better search/replace script?

From: arolls:bigpond:au at: 28-Nov-2000 18:19

Hi Nigel,
> OK, I'm still trying to write a general search/replace code block for use > with this Perl BBS I'm working with.
How about this: rebol [] post: {---- [quote]first[quote]second[/quote]third[/quote] --- ++and again++ --- [quote]first/2[quote]second/2[/quote]third/2[/quote] ---- Normal size text [size=4] large text[/size] normal text again } post: join p1 [p2] out: copy "" ; this is where the output goes. size: [ "[size=" copy s to "]" skip (append out reduce ["<font size=" s ">"]) [begin: text] | [end: "[/size]" (append out "</font>")] ] quote: [ "[quote]" (append out {^/<blockquote><hr><font size="1" face="verdana, helvetica">}) [begin: text] | [end: "[/quote]" (append out "</font><hr></blockquote>^/")] ] ; set of all ascii characters 0 - 255 character: charset compose [(to-char 0) - (to-char 255)] text: [ some [ [quote] | [size] | [copy c [character] (append out c)] ; let a character go through ] ] parse/all post text ; /all refinement - consider spaces too write %NigelBooker.html rejoin ["<html><body>" out "</body></html>"] browse %NigelBooker.html -Anton.