I've an issue like this: string filter: detect non-ASCII signs in C# but I should exclude all no-printable characters in a string except new line chars (\n).
Starting from Regex option:
foo = System.Text.RegularExpressions.Regex.Replace(foo, @"[^\u0020-\u007E]+", string.Empty);
I've modified it in this way:
foo = System.Text.RegularExpressions.Regex.Replace(foo, @"[\u0000-\u0009\u000B-\u000C\u000E-\u0019\u007F]+", string.Empty);
This seems to work correctly, but could you suggest a less verbose solution? Thanks in advance