If you have a finite and short set of elements to replace, you can just use a class, for example.
string.replace(/[?\^&]/g, '*');
and add as many characters as you want to reject. you can also add the Unicode character ranges you want to replace (e.g. \u017F-\036F\u0400-\uFFFF )
otherwise, use class a to indicate which characters do not need to be replaced, such as az, accented / diacritic letters, and Greek characters
string.replace(/[^az\00C0-\017E\u0370-\03FF]/gi, '*');
source share