Skip to content

Regular expression generator with examples

Choose the data type, copy the pattern and check how it behaves with an actual value. Each part of the regex is explained so that you can adapt it.

It works in your browser. We do not store or send anything you type.Free · No sign-up required

Workspace · Regular expression generator

Runs in your browser · 100% local
Patrón para correo electrónico

/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/

FragmentoQué hace
^ … $Ancla el inicio y el final: evita aceptar texto sobrante.
[A-Za-z0-9._%+-]+Usuario: letras, números y los signos habituales.
@[A-Za-z0-9.-]+Dominio, con al menos un punto.
\.[A-Za-z]{2,}Extensión de dos letras o más.

Coincide con el patrón

Estos patrones son puntos de partida. Para validar correos, URLs o teléfonos reales combina la regex con una comprobación adicional (por ejemplo, verificación de DNS o de formato E.164): una expresión regular no demuestra que un dato exista. Prueba cualquier variante en el probador de regex.

Files are processed in your browser; if you are signed in with history enabled, text results appear in your history.
Instructions

How to use it

01

Select the type of pattern you need from the list of options.

02

Copy the generated expression or edit it in your editor.

03

Test the actual variants in the test environment before deploying them to production.

Examples

Examples

Contact form

The email format requires a username, an @ symbol, a domain name and an extension of two letters or more, with no spaces.

Validate a slug

The slug pattern only allows lower-case letters, numbers and single hyphens between blocks.

Reference guide

What you need to know

A regular expression describes the format of a text, not its accuracy. Just because an email address matches the pattern does not mean the account exists; just because a URL appears valid does not guarantee that it will respond. For critical data, combine the regex with an additional check.

The patterns on this page are anchored with ^ and $ when used to validate an entire field. If you use them to search within a longer text, remove the anchors or use the appropriate word limits.

Frequently asked questions

Frequently Asked Questions

Most are compatible, but there are differences in syntax. Patterns containing \p{L} require the u flag in JavaScript and Unicode support in the target language.

Related tools

Other tools that can help with similar tasks.

More at Web development→
Regex generator with examples and explanations · ByTooly