# Pre-Validation

## Content



PreValidation or (raw string validation) is the process of validating the input string entered by the user, before parsing. Input provides The [PreValidation](/componentone/docs/win/online-input-net/) class that has the validation rules applied before converting the string entered by the user to the DataType.

Input string validation is controlled by the **PreValidation** property in TextBox, ComboBox and NumericEditor. The **PreValidation** class allows you to specify validation rules either as wildcard pattern strings or regular expression strings. All rules (strings) are specified in the [PatternString](/componentone/docs/win/online-input-net/) property. Multiple rules (sub-strings) are separated by the [ItemSeparator](/componentone/docs/win/online-input-net/) ('|' by default).

The PreValidation property defines how the PatternString is interpreted.

| Value | Description |
| --- | --- |
| ExactList | PatternString contains a list of possible values separated by ItemSeparator. |
| PreValidatingEvent | The PreValidating event is being used in validation. |
| Wildcards | PatternString contains a list of wildcard patterns separated by the ItemSeparator. The following characters are reserved in a pattern: ? (any single character), # (any single digit), \* (zero or more characters), \\ (escape). You can also define your own custom pattern characters using the PreValidation property. |
| RegexPattern | PatternString contains a regular expression. |

Using the [ValidatingEvent](/componentone/docs/win/online-input-net/) option, you can perform input string validation in code, in the Validating event. For more information, see the event description.

If you use regular expressions, the RegexPattern option, there is also a [RegexOptions](/componentone/docs/win/online-input-net/) property that is sometimes needed to set flags affecting regular expression functionality.

### Examples

The following examples describe how the Validation and PatternString properties are interpreted:

*   Validation property set to ExactList, PatternString property set to red|green|blue: Input string must be one of the three permitted values, red, green or blue, possibly ignoring the case, if CaseSensitive is set to **False**.
*   Validation property set to Wildcards, PatternString property set to (412)\*: Input string must start with (412), possibly ignoring the case, if CaseSensitive is set to **False**.
*   Validation property set to RegexPattern, PatternString set to [0-9\]\*: Input string contains one or more digits.