I am trying to validate the table/column name using this Stack Overflow answer, but it's not working.
For ValidateTableName("18_18_mapped")
, it returns false
. But for ValidateTableName("mappingStorage_f9dc07dbca414e2d86db00114a9104a3")
- it returns true
.
Any input on validating the table/column name would be helpful.
static void Main(string[] args)
{
bool temp = ValidateTableName("18_18_mapped"); // Returns false
...
}
private static bool ValidateTableName(string tableName)
{
string regexForTableName = @"^[\p{L}_][\p{L}\p{N}@$#_]{0,127}$";
return Regex.IsMatch("[" + tableName + "]", regexForTableName);
}