private string change字符(string str) { if (!string.IsNullOrEmpty(str)) { //将特殊字符全部替换为下划线 string pattern = "[\[ \] \^ \-_*×――(^)$%~!@#$…&%¥—+=<>《》!!???::•`·、。,;,;"‘’“”-]"; return Regex.Replace(str, pattern, "_"); } else { return ""; } }