Aller au contenu principal
kitlocal.dev

Aide-mémoire Regex

Exécution locale

Traitement à 100 % dans votre navigateur. Vos entrées et sorties ne quittent jamais votre appareil.

Syntaxe des expressions régulières et recettes réutilisables avec ateliers interactifs en direct : ancres, classes de caractères, quantificateurs, tests avant/arrière et drapeaux (ES2024).

Comment ça fonctionne

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 survie

Les quelques commandes à apprendre en premier.

41 commandes

Raccourcis clavier/Cibler la rechercheJKDéplacer la sélectionCCopier la sélectionFMettre la sélection en favoriEscEffacer la recherche

Characters & character classes

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

Documentation officielle : Character classes
  • Essentiel

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

    \d  \w  \s

    Quand l'utiliser

    Core shorthand character classes used in almost every pattern.

    Décomposition

    \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)

    Exemple

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

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

    Résultat

    ["2026-11-15"]

    Voir aussi

Anchors & boundaries

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

Documentation officielle : Assertions

Quantifiers & laziness

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

Documentation officielle : Quantifiers

Groups, alternation & backreferences

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

Documentation officielle : Groups and backreferences

Lookaheads, lookbehinds & flags

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

Documentation officielle : Assertions & flags

Essayer dans un outil KitLocal

Glossaire
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.

Vérifié le 15 nov. 2026 · Vérifié avec la version ES2024 RegExp

Sources: MDN Regular Expressions Guide · MDN RegExp Reference

Remplacez les éléments entre chevrons par vos propres valeurs. Les commandes proviennent de la documentation officielle et les exemples ont été exécutés sur la version indiquée.