I’m looking for a javascript function which takes a string parameter and checks for ascii characters lower than 32, replacing them with empty string -> “”. I’m new to javascript so I was wondering whether anyone can point me towards the right direction ?
Thanks in advance for your time.
Try this:
Using
^negates the characters class, and since space is character 32 in the ASCII table and ~ is the last printable character, you’re basically saying “everything that isn’t a printable character”.To simply remove all characters from 0-31 use: