Remove non ASCII characters

JavaScript, String, Regexp · Oct 22, 2020

Removes non-printable ASCII characters.

const removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, '');
removeNonASCII('äÄçÇéÉêlorem-ipsumöÖÐþúÚ'); // 'lorem-ipsum'

More like this

  • Remove whitespaces

    Returns a string with whitespaces removed.

    JavaScript, String · Nov 3, 2020

  • Unescape HTML

    Unescapes escaped HTML characters.

    JavaScript, String · Oct 22, 2020

  • String is anagram

    Checks if a string is an anagram of another string (case-insensitive, ignores spaces, punctuation and special characters).

    JavaScript, String · Oct 20, 2020