refactor regexp for printable characters