Monday, November 08, 2010 at 12:05 AM.

system.verbs.builtins.re.testing.replace

local (patternRef, ct);

<<patternRef = re.compile ("(a|(z))(bc)")
patternRef = re.compile ("\\b");
dialog.notify (re.replace (patternRef, "x", "1abc abc1"));


local (test = "To be or not to be");

patternRef = re.compile ("be");
test = re.replace (patternRef, "bebop", test);
dialog.notify (test);

patternRef = re.compile ("(be)(bop)");
test = re.replace (patternRef, "\\2\\1", test, adrReplacementCount:@ct);
dialog.notify (test + cr + "(" + ct + " replacements made)")



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.