Regular Expressions 101

Community Patterns

Sanitize CSV Export Expression for regex.replace (this regex) with empty string


Regular Expression
.NET 7.0 (C#)

[^0-9a-zA-Z|\\/ !#$%^&*()[{}\]:<>?_\\]+


see owasp recommendation for things to remove from a csv export.

this expression matches on following characters [. , ; + = - @ ' "] also carriage return

make sure to clear strings for whitespace and choose your preferred methods for additional security from the examples in the owasp documentation

Submitted by anonymous - 2 years ago