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); }
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); }