# RegexValidationRule

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.0.0.0)

* [ValidationRule](/api/wisej.web/extenders/validation/wisej.web.validationrule.md)
  * [RegexValidationRule](/api/wisej.web/extenders/validation/wisej.web.regexvalidationrule.md)

Validates the control using a custom [Regex](https://docs.microsoft.com/dotnet/api/system.text.regularexpressions.regex) expression.

{% tabs %}
{% tab title="C#" %}

```csharp
public class RegexValidationRule : ValidationRule
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class RegexValidationRule
    Inherits ValidationRule
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](/files/hsR4ok3152WyAf8J2C1u) RegexValidationRule()

Initializes a new instance of [RegexValidationRule](/api/wisej.web/extenders/validation/wisej.web.regexvalidationrule.md).

## Properties

### ![](/files/hsR4ok3152WyAf8J2C1u) FilterExpression

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the filter property (i.e. [Filter](/api/wisej.web/editors/wisej.web.textbox.md#filter)) property on editable controls that support filtering of the keys as they are typed. (Default: `null`)

### ![](/files/hsR4ok3152WyAf8J2C1u) Name

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the name of the validation rule. (Default: `"Regex"`)

### ![](/files/hsR4ok3152WyAf8J2C1u) ValidateExpression

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the [Regex](https://docs.microsoft.com/dotnet/api/system.text.regularexpressions.regex) used to validate the control. (Default: `null`)

## Methods

### ![](/files/hsR4ok3152WyAf8J2C1u) OnControlCreated(control)

Invoked when the control associated with the validation rule is created and ready to be rendered on the client.

| Parameter   | Type                                         | Description            |
| ----------- | -------------------------------------------- | ---------------------- |
| **control** | [Control](/api/wisej.web/general/control.md) | Control being created. |

### ![](/files/hsR4ok3152WyAf8J2C1u) OnValidating(control)

Validates the *control* using the validation rule.

| Parameter   | Type                                         | Description |
| ----------- | -------------------------------------------- | ----------- |
| **control** | [Control](/api/wisej.web/general/control.md) |             |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the validation is successful; otherwise false.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/api/wisej.web/extenders/validation/wisej.web.regexvalidationrule.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
