title: Regex to match specific non-printable characters on the ASCII table
body: <p>I am writing a function that checks if the decimal value of a character is printable, and returns a symbol if it is not printable. On the ASCII table, decimal values 0 to 31 and 127 are non-printable, but I want the symbol returned for these specific decimal values only  (0-8, 11, 12, 16-19,21-31, 127). How can I better my code using regex? I am also willing to learn any optimization you can suggest.</p>
  <pre class="lang-js prettyprint-override"><code>function replaceNonPrintableWithSymbol(character) {
    let noEntrySymbol = &quot;\u26D4&quot;;
    let characterDecimalValue = character.charCodeAt();
    let specificNonPrintableValues = [0,1,2,3,4,5,6,7,8,11,12,16,17,18,19,21,22,23,24,25,26,27,28,29,30,31,127];
    let isWithinRange = specificNonPrintableValues.includes(characterDecimalValue);
  
    return isWithinRange? noEntrySymbol : character;
  }
  </code></pre>