码迷,mamicode.com
首页 > Web开发 > 详细

.NET 验证目录及文件中的特殊字符

时间:2017-08-08 15:33:42      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:match   val   char   .net   for   tin   cap   cape   reg   

string regexSearch = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars());
Regex reg = new Regex(string.Format("[{0}]", Regex.Escape(regexSearch)));
Match m = reg.Match(newname);

.NET 验证目录及文件中的特殊字符

标签:match   val   char   .net   for   tin   cap   cape   reg   

原文地址:http://www.cnblogs.com/lover24/p/7306420.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!