public static bool IsValidNameOrConstant(string s)
{
string[] mustMatchWith = {
@"^[a-zA-Z_][a-zA-Z_0-9]*$" /* a constant, function name - can not start with a number */,
@"^[0-9]*$",
@"^[0-9]+.[0-9]*$",
@"^[0-9]*.[0-9]+$",
};
for (int j=0;j<mustMatchWith.Length;j++)
{
if (Regex.IsMatch(s,mustMatchWith[j]))
{
return true;
}
}
return false;
}