17 using System.Text.RegularExpressions;
19 using erminas.SmartAPI.CMS.Project.ContentClasses.Elements;
21 namespace erminas.SmartAPI.CMS.Project.Pages.Elements
28 [PageElementType(
ElementType.StandardFieldUserDefined)]
31 public static readonly Regex NUMERIC_CHECK_REGEX =
32 new Regex(
"^\\s*(-)?((\\d+((\\.|\\,)\\d*)?)|((\\.|\\,)\\d+))([eE](-)?\\d+)?\\s*$");
37 internal StandardFieldUserDefined(
IProject project, XmlElement xmlElement, Regex regex)
38 : base(project, xmlElement)
44 internal StandardFieldUserDefined(
IProject project, XmlElement xmlElement) : base(project, xmlElement)
51 get {
return _regex; }
54 public override string Value
58 if (!
string.IsNullOrEmpty(value) && !_regex.IsMatch(value))
60 throw new ArgumentException(
"Value doesn't match regular expression");
66 protected override string FromString(
string value)
71 protected override void LoadWholeStandardField()
76 private void LoadXml()
78 InitIfPresent(ref _maxSize,
"eltmaxsize",
int.Parse);
79 InitIfPresent(ref _regex,
"eltverifytermregexp", x =>
new Regex(x));