# Input String Validation (PreValidation)

This topic provides info about Input String Validation in C1Input.

## Content



Input string validation is controlled by the [PreValidation](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.PreValidation.html) property. The [PreValidation](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.PreValidation.html) 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/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.PreValidation.PatternString.html) property. Multiple rules (sub-strings) are separated by the [ItemSeparator](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.PreValidation.ItemSeparator.html) ('|' by default).

The PreValidation property defines how the PatternString is interpreted.

| Value | Description |
| --- | --- |
| [ExactList](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.PreValidationTypeEnum.html) | 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 PreValidatingEvent option, you can perform input string validation in code, in the PreValidating event. For more information, see the event description.

If you use regular expressions, the RegexPattern option, there is also a [RegexOptions](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.PreValidation.RegexOptions.html) property that is sometimes needed to set flags affecting regular expression functionality.


> type=note
> **Note**: Input string validation (PreValidation) is not used in [DateTimeInput](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.DateTimeInput.html) and [NumericInput](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.NumericInput.html) modes. When DateTimeInput or NumericInput modes are active is [Typed Value Validation (PostValidation)](/componentone/docs/win/online-input/usingthec1inputcontr/validatingdata/typedvaluevalidation) is performed.

### Examples

The following examples describe how the [Validation](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.PreValidation.Validation.html) 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](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.PreValidation.CaseSensitive.html) 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.

## See Also

[Typed Value Validation (PostValidation)](/componentone/docs/win/online-input/usingthec1inputcontr/validatingdata/typedvaluevalidation)