Featured On ...

asp.net

totalasp.co.uk

fuzzysoftware.com

devdex.com

123aspx.com

dotnetfreaks.com

411asp.net

and more ...

ValidatorEntryRegex

Full path

MadWidgets.Validation.ValidatorEntryRegex

Declaration

public class ValidatorEntryRegex : ValidatorEntrySingleObject

Hierarchy

Click on the selected class to view any properties or methods that may be accessible through an instance of this class through inheritance.

ValidatorEntryRegex

Overview

The ValidatorEntryRegex class is used to validate an object against a regular expression. The regular expression supplied to the constructor of this class must be compatible with both ECMAScript regular expressions and .NET regular expressions (found in the System.Text.RegularExpressions package). Standard UNIX style regular expressions tend to be compatible with both for the most part.

To ensure that the regular expression matches the entire entry in the object being validated, you should add the ^ and $ markers in the expression to mark the beginning and end of the captured text respectively.

The ValidatorEntryRegex class should also be used to test for value matching as well as regular expressions. For example, if you have a select list containing the series of values, RED, WHITE and BLUE, you could test that the WHITE option has been selected by making the expression WHITE as in the following example:

void Page_Load(object o, EventArgs ea)
{
Validator v = Validator.Current;
.
.
.
v.Add(new ValidatorEntryRegex(Colour, "Please select the colour WHITE.", null, true, false, "^WHITE$", RegexOptions.IgnoreCase));
.
.
.
}

Constructors


Constructors

ValidatorEntryRegex

public ValidatorEntryRegex(object o, string sMessage, string sHighlightElement, bool bRequired, bool bNegate, string sExpression)

Creates a ValidatorEntryRegex validating the object o, with a message, a client-side highlight element signature, a boolean indicating whether the object must have a non-blank value, a negate boolean and a regular expression.

ValidatorEntryRegex

public ValidatorEntryRegex(object o, string sMessage, string sHighlightElement, bool bRequired, bool bNegate, string sExpression, RegexOptions reOptions)

Creates a ValidatorEntryRegex validating the object o, with a message, a client-side highlight element signature, a boolean indicating whether the object must have a non-blank value, a negate boolean, a regular expression and zero or more regular expression options found in the flagged System.Text.RegularExpressions.RegexOptions enumeration.

© 2002 - 2008 Copyright, Disclaimer and Privacy Statement