@genexus/web-standard-functions
Version:
GeneXus JavaScript standard functions library for web generators
18 lines • 567 B
JavaScript
/**
* @param Returns a string resulting from replacing all the occurrences of pattern in target by repstr
* @param replaceString
* @return string
*/
import { GxRegEx } from "../types/gxRegEx";
export const replaceRegExp = (target, pattern, repstr) => {
try {
new GxRegEx(0, "");
let regularExp = typeof pattern === "string" ? new RegExp(pattern, "g") : pattern;
return target.replace(regularExp, repstr);
}
catch (err) {
new GxRegEx(1, err.message);
return "";
}
};
//# sourceMappingURL=replaceRegExp.js.map