STRING::REPLACE 1g 2025-09-28 laplante@plcb.ca GOWEB/STRING — Replace Using Regular Expressions


title: “STRING::REPLACE” version: “1.0.0” date: 2025-09-28 author: “laplante@plcb.ca” section: “1g” category: “GOWEB/STRING”


Name

string::replace Replace sub-string in a string

Synopsis

**string::replace** or **replace**(string, substring, newSubString[, limit:integer])

Description

Replace returns a copy of the string s with the first n non-overlapping instances of old replaced by new. If old is empty, it matches at the beginning of the string and after each UTF-8 sequence, yielding up to k+1 replacements for a k-rune string. If n < 0, there is no limit on the number of replacements.


Examples


res={{
    str := "Objective-C is the language of Apple";
    replace(str, "Objective-C", "Swift"); "\n";
    replace(str, "e","E", limit:1);
}}.

return

res=Swift is the language of Apple
ObjEctive-C is the language of Apple.

Author

laplante@plcb.ca

See Also


Version