---
description: >-
  This section describes the built-in validation checks and rules of
  EasyValidation library.
---

# Built-in Rules

The **EasyValidation** library comes with 30+ built-in validation checks and rules. These rules can be added manually by [custom rules](create-custom-rules) or can be used with [extension method](validation-using-extension-methods) or [collection extension methods](collection-extensions).

&#x20;You can apply these rules by calling `addRule()` method of the `Validator` object like this.

```kotlin
var validator = myTextView.validator()
var isValid = validator.addRule(EmailRule()).check()
```

Here is a list of all those rules with their respective methods and collection extensions.

| Rule Class                       | Method Names                    | Description                                                                                                                                                                 |
| -------------------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NonEmptyRule`                   | `nonEmpty()`                    | Returns `true` if the text is not empty. And returns `false` if text is empty.                                                                                              |
| `MinLengthRule`                  | `minLength()`                   | Returns `false` if the length of text is less than given minimum length.                                                                                                    |
| `MaxLengthRule`                  | `maxLength()`                   | Returns `false` if text length is greater than given length                                                                                                                 |
| `EmailRule`                      | `validEmail()`                  | Returns `true` if text is a valid email address.                                                                                                                            |
| `ValidNumberRule`                | `validNumber()`                 | Returns `true` if the text is any valid number                                                                                                                              |
| `GreaterThanRule`                | `greaterThan()`                 | Returns `false` if the text is number less than the given target number                                                                                                     |
| `GreaterThanOrEqualRule`         | `greaterThanOrEqual()`          | Returns `false` if the text is number less than or equal to the given target number                                                                                         |
| `LessThanRule`                   | `lessThan()`                    | Returns `false` if the text is number greater than the given target number                                                                                                  |
| `LessThanOrEqualRule`            | `lessThanOrEqaul()`             | Returns `false` if the text is number greater than or equal to the given target number                                                                                      |
| `NumberEqualToRule`              | `numberEqualTo()`               | Returns `false` if the text is a valid number and equal to the given target number                                                                                          |
| `AllUpercCaseRule`               | `allUperCase()`                 | Returns `false` if at least one or more characters are lower case                                                                                                           |
| `AllLowerCaseRule`               | `allLowerCase()`                | Returns `false` if at least one or more characters are upper case                                                                                                           |
| `AtLeastOneUperCaseRule`         | `atleastOneUperCase()`          | Returns `true` if at least one or more characters are upper case                                                                                                            |
| `AtLeastOneLowerCaseRule`        | `atleastOneLowerCase()`         | Returns `true` if at least one or more characters are lower case                                                                                                            |
| `AtLeastOneNumberCaseRule`       | `atleastOneNumber()`            | Returns `true` if at least one or more characters are numbers                                                                                                               |
| `StartsWithNumberRule`           | `startWithNumber()`             | Returns `true` if text starts with any number                                                                                                                               |
| `StartsWithNoNumberRule`         | `startWithNonNumber()`          | Returns `false` if text starts with any number                                                                                                                              |
| `NoNumbersRule`                  | `noNumbers()`                   | Returns `false` if the text any number or digit.                                                                                                                            |
| `OnlyNumbersRule`                | `onlyNumbers()`                 | Returns `false` if text contains any alphabetic character                                                                                                                   |
| `NoSpecialCharacterRule`         | `noSpecialCharacters()`         | Returns `true` if text contain no special characters                                                                                                                        |
| `AtleastOneSpecialCharacterRule` | `atleastOneSpecialCharacters()` | Returns `true` if text contain at least one special characters                                                                                                              |
| `TextEqualToRule`                | `textEqaulTo()`                 | Returns `false` if the text is not equal to the given text                                                                                                                  |
| `TextNotEqaulToRule`             | `textNotEqualTo()`              | Returns `true` if the text is not equal to the given text                                                                                                                   |
| `StartsWithRule`                 | `startsWith()`                  | Returns `true` if the text starts with the given text                                                                                                                       |
| `EndsWithRule`                   | `endsWith()`                    | Returns `true` if the text ends with the given text                                                                                                                         |
| `ContainsRule`                   | `contains()`                    | Returns `true` if the text contains the given text                                                                                                                          |
| `NotContainsRule`                | `notContains()`                 | Returns `false` if the text contains the given text                                                                                                                         |
| `CreditCardRule`                 | `creditCardNumber()`            | Returns `true` if the text is valid credit card number. This supports Visa, Master Card, American Express, Diners Club, Discover, and JCB.                                  |
| `CreditCardWithSpacesRule`       | `creditCardNumberWithSpaces()`  | Returns `true` if the text is valid credit card number with spaces between 4 characters. This supports Visa, Master Card, American Express, Diners Club, Discover and JCB.  |
| `CreditCardWithDashesRule`       | `creditCardNumberWithDashes()`  | Returns `true` if the text is valid credit card number with dashes between 4 characters. This supports Visa, Master Card, American Express, Diners Club, Discover, and JCB. |
| `ValidUrlRule`                   | `validUrl()`                    | Returns `true` if the text is a valid URL                                                                                                                                   |
| `RegexRule`                      | `regex()`                       | Returns `true` if the text matches passed `RegEx` pattern                                                                                                                   |
