String.prototype.replace()
with a regular expression to remove non-printable ASCII characters.const removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, '');
removeNonASCII('äÄçÇéÉêlorem-ipsumöÖÐþúÚ'); // 'lorem-ipsum'
Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️