# RegexValidationRule

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-xaml-interactions-custom/struct-regexvalidationrule/

**struct** · [`ferroui-xaml-interactions-custom`](/docs/0.5.0/api/ferroui-xaml-interactions-custom/) · v0.5.0

```rust
struct RegexValidationRule
```

Validation rule that checks that a string matches a regular expression.

Deviation (DEVIATIONS.md, Behaviors): the pattern is a pattern of the `regex` crate, whose
syntax is that of the reference's regular expressions without look-around and
back-references; a pattern that does not compile matches nothing (the reference throws).

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/rules/regex_validation_rule.rs#L18)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`pattern_property`](#function-pattern_property)
- [`error_message_property`](#function-error_message_property)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`pattern`](#function-pattern)
- [`set_pattern`](#function-set_pattern)
- [`error_message`](#function-error_message)
- [`set_error_message`](#function-set_error_message)
- [`validate`](#function-validate)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/rules/regex_validation_rule.rs#L25)

<a id="function-to_ref"></a>

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<RegexValidationRule>
```

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/rules/regex_validation_rule.rs#L25)

<a id="function-pattern_property"></a>

### pattern_property

```rust
fn pattern_property() -> &'static StyledProperty<String>
```

Identifies the `Pattern` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/rules/regex_validation_rule.rs#L29)

<a id="function-error_message_property"></a>

### error_message_property

```rust
fn error_message_property() -> &'static StyledProperty<Option<String>>
```

Identifies the `ErrorMessage` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/rules/regex_validation_rule.rs#L29)

<a id="function-construct"></a>

### construct

```rust
fn construct() -> Self
```

Creates the class data; see `ferroui_base::FerroObject::construct`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/rules/regex_validation_rule.rs#L50)

<a id="function-new"></a>

### new

```rust
fn new() -> Ref<Self>
```

Creates a rule.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/rules/regex_validation_rule.rs#L55)

<a id="function-pattern"></a>

### pattern

```rust
fn pattern(self: &Self) -> String
```

Gets or sets the regular expression pattern. This is a property of the object model.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/rules/regex_validation_rule.rs#L60)

<a id="function-set_pattern"></a>

### set_pattern

```rust
fn set_pattern(self: &Self, value: String)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/rules/regex_validation_rule.rs#L64)

<a id="function-error_message"></a>

### error_message

```rust
fn error_message(self: &Self) -> Option<String>
```

Gets or sets the error message for failed validation. This is a property of the object
model.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/rules/regex_validation_rule.rs#L70)

<a id="function-set_error_message"></a>

### set_error_message

```rust
fn set_error_message(self: &Self, value: Option<String>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/rules/regex_validation_rule.rs#L74)

<a id="function-validate"></a>

### validate

```rust
fn validate(self: &Self, value: Option<&BoxedValue>) -> bool
```

Validates the specified value: valid when it is a text that matches the pattern.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/rules/regex_validation_rule.rs#L79)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<RegexValidationRule>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`IValidationRule`](/docs/0.5.0/api/ferroui-xaml-interactions-custom/trait-ivalidationrule/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
