我正在寻找适用于Windows的免费xslt调试工具.有人使用任何值得推荐的东西吗?感谢任何建议,谢谢.
我正在使用RegularExpressionAttribute
验证属性.该物业需要允许anything but zero length string, null, or (just) spaces
.我正在使用的正则表达式是"^(?!^ *$)^.+$"
.
如果值为null
或an empty string
,则RegularExpressionAttribute.IsValid
始终返回true但我认为它应该为false(只有空格才能正常工作).
我不是正则表达式专家,但我相信表达式是正确的(如果我使用Regex.IsMatch
空字符串直接从我的代码验证正则表达式返回false - 如预期的那样).这是RegularExpressionAttribute的问题吗?
(我知道在这种情况下,RequiredAttribute通常是一个快速但不是一个选项)
更新:
为了消除任何歧义,这里有一小段测试代码来演示:
public class MyValueTester
{
// internal const string _REGEX_PATTERN = "^(?!\\s*$).+$";
// internal const string _REGEX_PATTERN = @"^(?!\s*$)";
internal const string _REGEX_PATTERN = @"[^ ]";
public MyValueTester()
{
ProperValue = "hello";
NullValue = null;
SpaceValue = " ";
LeadingSpaceValue = " hi";
EmptyValue = "";
}
[RegularExpression(_REGEX_PATTERN, …
Run Code Online (Sandbox Code Playgroud)