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

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

From: lmecir:mbox:vol:cz at: 10-Dec-2002 14:01

Hi Joel, Gabriele, ----- Original Message ----- From: "Gabriele Santilli"
> Now, I don't claim this to be more readable, because you need to > provide a rule to match the text that does not match the pattern > rule, ...
How about this: digits: charset "1234567890" pattern-replace: function [ string [string!] match-pattern [block! string! char! bitset!] replacement [string! char!] ] [result] [ result: make string! length? string parse/all string [ any [ match-pattern (append result replacement) | copy txt skip (append result txt) ] ] result ]
>> pattern-replace "Replace 5248 with a #" [some digits] "#"
== "Replace # with a #" Cheers -L