Extracted from Pike v7.6 release 61 at 2005-12-30.
pike.ida.liu.se
[Top]
Regexp
Regexp.PCRE
Regexp.PCRE._Regexp_PCRE
Regexp.PCRE._Regexp_PCRE.Plain

Method Regexp.PCRE._Regexp_PCRE.Plain()->replace()


Method replace

string replace(string subject, string|function(string:string) with)

Description

replace all occurances of a pattern in a subject; callbacks and replacements will be from the first occurance, not from the last as in Regexp.Builtin.replace.

example: > Regexp.PCRE("b[^-]*m")->replace("abam-boom-fooabadoom","gurka"); Result: "agurka-gurka-fooagurka" > Regexp.PCRE("b[^-]*m")->replace("abam-boom-fooabadoom", lambda(string s) { werror("%O\n",s); return "gurka"; }); "bam" "boom" "badoom" Result: "agurka-gurka-fooagurka"