I am working off this answer here: Regex for removing special characters on a multilingual string:
/\P{Xan}+/u
but this appears to be for PHP, I am not any good at regex, so what would the javascript equivelent be?
When I use the regex in the example answer, I get an invalid expression error telling me there is an invalid escape?
search(event) {
const length = (string) => {
if (string.length > 1) {
return true;
}
return false;
};
const trim = (string) => {
if (string.trim() !== '') {
return true;
}
return false;
};
const keyType = (string) => {
const regex = /\P{Xan}+/u;
if (!regex.exec(string)) {
return true;
}
return false;
};
const text = this.searchListParams.searchText;
if (length(text) && trim(text) && keyType(text)) {
this.searchSubject.next(this.searchListParams);
} else {
this.mediaListParams.startRow = 0;
this.listSubject.next(this.mediaListParams);
}
}