title: regex expression for any letter, number and "normal" characters
body: <p>I receive bytes into a method and I want to send them over serial, but I only want to send valid bytes, (i.e. a-zA-Z0-9"!£$%^&amp;*()-_=+), things like that, spaces, new lines etc. I just want to filter out any character like ones with accents or �, in any order and any number of times.</p>
  
  <p>Would something like this including all characters with <code>|</code> work?</p>
  
  <pre><code>^[a-z|A-Z|0-9|\\s|-&lt;other characters&gt;]*
  </code></pre>
  
  <p>Or, what would be the correct expression?</p>
  
  <p>So if a string contained "exit����", I would only want to send "exit", and never send characters that are not valid, but send everything else.</p>
  
  <pre><code>public void write(byte[] bytes, int offset, int count) {
    String str;
    try {
      str = new String(bytes, "ASCII");
      Log.d(TAG, "data received in write: " +str );
      //^[a-z|A-Z|0-9|\s|-]*
      //test here, call next line on any character that is valid
      GraphicsTerminalActivity.sendOverSerial(str.getBytes("ASCII"));
    } catch (UnsupportedEncodingException e) {
      Log.d(TAG, "exception" );
      e.printStackTrace();
    }
    // appendToEmulator(bytes, 0, bytes.length);
  }
  </code></pre>
  
  <p>EDIT: I tried [^\x00-\x7F] which is the range of ascii characters....but then the  � symbols still get through, weird.</p>