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

[REBOL] Re: REBOL embedded $variables regexp/no

From: g:santilli:tiscalinet:it at: 10-Dec-2002 15:16

Hi Ladislav, On Tuesday, December 10, 2002, 2:01:38 PM, you wrote: LM> How about this: [...] Yes, I've done exactly that in my NOT-RULE defined in that email. However, I think this is too inefficient, and in most cases you can very easily provide a rule for the non-matching part of the text which is much more efficient. So, I'd prefer to leave that to the user, if he/she does not care about the time he/she can use NOT-RULE. Maybe I should have actually coded it as: pattern-replace: func [string match-pattern replacement /text-rule text-pattern /local result txt] [ result: make string! length? string text-pattern: any [text-pattern not-rule match-pattern] parse/all string [ copy txt text-pattern (emit result txt) any [match-pattern (emit result replacement) copy txt text-pattern (emit result txt)] ] result ] or something like that. LM> replacement [string! char!] Also, I wanted to have blocks here too as input, so that it is possible to do the replacement based on the match as with the dates example. Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: