【发布时间】:2015-05-10 13:08:42
【问题描述】:
我正在使用 C# 代码创建动态 SQL Server 表,但我需要验证表名。
什么是验证 SQL Server 表名的正则表达式?
【问题讨论】:
-
\w有什么问题?即[a-zA-Z0-9_]?? -
关于这个正则表达式 regex = new Regex(@"^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz[]. -_0123456789]{1,128}$"); if (!regex.IsMatch(tableName)) throw new ApplicationException("Invalid table name");
标签: regex sql-server-2008 c#-4.0