/ Published in: C#
Replace invalid to valid file name by using RegEx
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
static string removeBadChar(string filename) { // Replace invalid characters with "_" char. return Regex.Replace(filename, @"[^\w\.-]", "_"); }