Beispiel #1
0
 protected override bool ValidateControl()
 {
     if (ElementToValidate is TextBox && RegExpression != null)
     {
         TextBox box = ElementToValidate as TextBox;
         if (String.IsNullOrEmpty(box.Text))
         {
             return(!IsRequired);
         }
         return(RegExpression.Match(box.Text).Success);
     }
     return(true);
 }
Beispiel #2
0
        public string Parse(string text)
        {
            const int start = 0;
            var       m     = RegExpression.Match(text, start);

            while (m.Success)
            {
                text = text.Remove(m.Index, m.Length);
                var insertion = String.Format(Replacement, m.Value);
                text = text.Insert(m.Index, insertion);
                m    = m.NextMatch();
            }

            return(text);
        }