forked from vikunja/frontend
konrad
c8209c6c10
Co-authored-by: kolaente <k@knt.li> Reviewed-on: vikunja/frontend#570 Co-authored-by: konrad <konrad@kola-entertainments.de> Co-committed-by: konrad <konrad@kola-entertainments.de>
15 lines
375 B
JavaScript
15 lines
375 B
JavaScript
/**
|
|
* This function replaces all text, no matter the case.
|
|
*
|
|
* See https://stackoverflow.com/a/7313467/10924593
|
|
*
|
|
* @parma str
|
|
* @param search
|
|
* @param replace
|
|
* @returns {*}
|
|
*/
|
|
export const replaceAll = (str, search, replace) => {
|
|
const esc = search.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
const reg = new RegExp(esc, 'ig');
|
|
return str.replace(reg, replace);
|
|
} |