Skip to content

Regex

The Regex module provides a set of functions for validating strings using regular expressions. These functions return a boolean value (true/false) indicating whether the string matches the specified pattern.

All functions are optimized for performance and follow best validation practices for each specific case.

Overview

isAlpha

typescript
isAlpha(value: string): boolean;

Checks if the string contains only alphabetic characters (letters), including accents.

isAlphanumeric

typescript
isAlphanumeric(value: string): boolean;

Checks if the string contains only letters and numbers, without symbols or spaces.

isEmail

typescript
isEmail(value: string): boolean;

Checks if the string matches the format of a valid email.

isURL

typescript
isURL(value: string): boolean;

Checks if the string matches the format of a valid URL (http/https).

isCreditCard

typescript
isCreditCard(value: string): boolean;

Checks if the string matches the format of a valid credit card number.

isSlug

typescript
isSlug(value: string): boolean;

Checks if the string is in slug format (lowercase letters, numbers, and hyphens).

isIPV4

typescript
isIPV4(value: string): boolean;

Checks if the string matches the format of a valid IPv4 address, with or without port.

isIPV6

typescript
isIPV6(value: string): boolean;

Checks if the string matches the format of a valid IPv6 address, with or without port.

isBase64URL

typescript
isBase64URL(value: string): boolean;

Checks if the string is in Base64URL format.

isJWT

typescript
isJWT(value: string): boolean;

Checks if the string matches the format of a JSON Web Token (JWT).

isFileExtension

typescript
isFileExtension(value: string): boolean;

Checks if the string matches the format of a file extension.

Released under the MIT License.