string to search
compiled regular expression to use
format string to generate replacements from, see the format string.
A string of the same type as input with the all of the matches (if any) replaced. If no match is found returns the input string itself.
// insert comma as thousands delimiter auto re = regex(r"(?<=\d)(?=(\d\d\d)+\b)","g"); assert(replaceAll("12000 + 42100 = 54100", re, ",") == "12,000 + 42,100 = 54,100");
Construct a new string from input by replacing all of the fragments that match a pattern re with a string generated from the match according to the format specifier.
To replace only the first match use replaceFirst.