Validators
Validare ships 51 built-in validators across 7 categories. All validators pass on empty string — combine with notEmpty to require a value.
Core (23)
| Validator | Description |
|---|---|
| notEmpty | Not empty (supports trim) |
| blank | Empty (opposite of notEmpty, supports trim) |
| Valid email address | |
| creditCard | Credit card number (Luhn check) |
| date | Date in a specified format |
| digits | Digits only |
| integer | Integer (positive or negative) |
| numeric | Numeric value |
| regexp | Matches a regular expression |
| uri | Valid URL |
| identical | Equal to another field |
| different | Different from another field |
| between | Between min and max |
| greaterThan | Greater than (or equal to) a value |
| lessThan | Less than (or equal to) a value |
| stringLength | String length (min/max) |
| stringCase | Uppercase or lowercase |
| choice | Number of checked checkboxes |
| file | File type and size |
| callback | Custom synchronous function |
| promise | Custom async function |
| remote | Remote validation via HTTP |
| ip | IP address (IPv4 and IPv6) |
Format & Encoding (6)
| Validator | Description |
|---|---|
| base64 | Base64-encoded string |
| hex | Hexadecimal number |
| mac | MAC address |
| bic | BIC/SWIFT code |
| uuid | UUID (v3, v4, v5) |
| color | CSS color (#hex, rgb, hsl, named) |
Financial Instruments (6)
| Validator | Description |
|---|---|
| iban | IBAN (77 countries) |
| vat | VAT number (requires country) |
| cusip | CUSIP (North American securities) |
| isin | ISIN (International Securities Identification Number) |
| sedol | SEDOL (London Stock Exchange) |
| grid | GRId (Global Release Identifier) |
Publication Codes (4)
| Validator | Description |
|---|---|
| ean | EAN barcode (EAN-8 and EAN-13) |
| isbn | ISBN-10 and ISBN-13 |
| ismn | ISMN (International Standard Music Number) |
| issn | ISSN (International Standard Serial Number) |
Device & Vehicle (5)
| Validator | Description |
|---|---|
| imei | IMEI (mobile device identifier) |
| imo | IMO vessel number |
| meid | MEID (CDMA device identifier) |
| step | Multiple of a step value |
| vin | VIN (Vehicle Identification Number, USA) |
Tax & Business (4)
| Validator | Description |
|---|---|
| ein | EIN (US Employer Identification Number) |
| rtn | RTN (US Routing Transit Number) |
| siren | SIREN (French company identifier) |
| siret | SIRET (French establishment identifier) |
Identity & Geographic (3)
| Validator | Description |
|---|---|
| id | National ID number (42 countries, requires country) |
| phone | Phone number (requires country) |
| zipCode | Postal/ZIP code (requires country) |