Is there a way to summarize a replace function and make the code a bit cleaner? I haven't found a way to do this yet and cannot find an answer on here.
replaceFunction(string) {
this.string = (encodeURIComponent(string.toLowerCase()
.replace('/%[a-fA-F0-9]{2}/','-')
.replace('/-+/','-')
.replace('/-$/','')
.replace('/^-/','')
.replace('ä','ae')
.replace('ö','oe')
.replace('ü','ue')
.replace('Ä','ae')
.replace('Ö','oe')
.replace('Ü','ue')
.replace('_','-')
.replace('.','-')
.replace(/\s/g, '-')
.replace(/["']/g, '')
));
return string;
}