Ir al contenido principal
kitlocal.dev

Chuleta de Regex

Ejecución local

Procesado al 100 % en tu navegador. Las entradas y salidas nunca salen de tu dispositivo.

Sintaxis de expresiones regulares y recetas reutilizables con laboratorios interactivos en directo: anclajes, clases de caracteres, cuantificadores, lookarounds y modificadores (ES2024).

Cómo funciona

A regex engine scans left-to-right trying to satisfy your pattern at each position. Quantifiers (*, +, {n,m}) are greedy by default (consuming as much as possible before backtracking); append `?` to make them lazy, and anchor with `^`/`$` or `\b` when you need exact boundaries.

Kit de supervivencia

Los comandos clave que conviene aprender primero.

41 comandos

Atajos de teclado/Enfocar búsquedaJKMover selecciónCCopiar seleccionadoFMarcar seleccionadoEscBorrar búsqueda

Characters & character classes

Match single characters by category (`\d`, `\w`, `\s`) or explicit sets (`[a-f0-9]`). Uppercase shorthands invert the match.

Documentación oficial: Character classes
  • Esencial

    Match a digit, word character ([A-Za-z0-9_]) or whitespace.

    \d  \w  \s

    Cuándo usarlo

    Core shorthand character classes used in almost every pattern.

    Desglose

    \d
    ASCII digit [0-9] (uppercase \D = non-digit)
    \w
    alphanumeric + underscore (uppercase \W = non-word)
    \s
    space, tab or newline (uppercase \S = non-whitespace)

    Ejemplo

    Matches dates inside `"release 2026-11-15"`.

    \d{4}-\d{2}-\d{2}

    Resultado

    ["2026-11-15"]

    Véase también

Anchors & boundaries

Anchors match positions (start/end of string, line or word) rather than consuming characters.

Documentación oficial: Assertions

Quantifiers & laziness

Control how many times the preceding token repeats. Add `?` after any quantifier to match as few times as possible.

Documentación oficial: Quantifiers

Groups, alternation & backreferences

Parentheses group sub-expressions for quantifiers/alternation and capture text for extraction or backreferences.

Documentación oficial: Groups and backreferences

Lookaheads, lookbehinds & flags

Check what appears ahead or behind the current position without making it part of the matched text.

Documentación oficial: Assertions & flags

Pruébalo en una herramienta de KitLocal

Glosario
Greedy vs Lazy
`.*` grabs to the last possible match; `.*?` stops at the earliest match.
Lookaround
Zero-width assertion (`(?=...)`, `(?!...)`, `(?<=...)`) that checks surrounding text without consuming characters.
Backtracking
When a quantifier gives up matched characters so later tokens can match; nested `*`/`+` can cause ReDoS.
Zero-width
Tokens like `^`, `$`, `\b` and lookarounds that match a position rather than characters.

Comprobado el 15 nov 2026 · Comprobado con ES2024 RegExp

Fuentes: MDN Regular Expressions Guide · MDN RegExp Reference

Sustituye todo lo que esté entre corchetes angulares por tus propios valores. Los comandos proceden de la documentación oficial y los ejemplos se ejecutaron en la versión indicada.