Skip to main content
CheckTown

Aide-memoire Regex

Reference interactive de regex avec groupes de syntaxe, patterns a copier rapidement et exemples en direct pour les cas d'utilisation courants.

Classes de caracteres

.

Correspond a n'importe quel caractere sauf le retour a la ligne

a.c matches "abc", "a1c"

\d

Correspond a n'importe quel chiffre (0-9)

\d+ matches "123" in "abc123"

\D

Correspond a tout caractere non numerique

\D+ matches "abc" in "abc123"

\w

Correspond a tout caractere de mot (a-z, A-Z, 0-9, _)

\w+ matches "hello_1"

\W

Correspond a tout caractere non-mot

\W matches "!" in "hello!"

\s

Correspond a tout espace blanc (espace, tabulation, retour a la ligne)

\s matches " " in "a b"

\S

Correspond a tout caractere non-espace

\S+ matches "hello"

[abc]

Correspond a n'importe quel caractere de l'ensemble

[aeiou] matches "e" in "hello"

[^abc]

Correspond a tout caractere absent de l'ensemble

[^aeiou] matches "h" in "hello"

[a-z]

Correspond a n'importe quel caractere dans la plage

[a-f] matches "c" in "cat"

Ancres

^

Correspond au debut de la chaine ou de la ligne

^Hello matches "Hello world"

$

Correspond a la fin de la chaine ou de la ligne

world$ matches "Hello world"

\b

Correspond a une position de limite de mot

\bcat\b matches "cat" not "catch"

\B

Correspond a une position de non-limite de mot

\Bcat matches "cat" in "scat"

Quantificateurs

*

Correspond a zero ou plus de l'element precedent

ab*c matches "ac", "abc", "abbc"

+

Correspond a un ou plus de l'element precedent

ab+c matches "abc", "abbc" not "ac"

?

Correspond a zero ou un de l'element precedent

colou?r matches "color", "colour"

{n}

Correspond exactement a n de l'element precedent

\d{3} matches "123" not "12"

{n,}

Correspond a n ou plus de l'element precedent

\d{2,} matches "12", "123", "1234"

{n,m}

Correspond entre n et m de l'element precedent

\d{2,4} matches "12", "123", "1234"

*?

Correspond au minimum de caracteres possible (paresseux)

<.*?> matches "<b>" in "<b>text</b>"

Groupes et Lookaround

(...)

Capture le groupe correspondant pour les references arriere

(abc)+ matches "abcabc"

(?:...)

Groupe sans capturer la correspondance

(?:abc)+ groups without capture

(?=...)

Lookahead positif : correspond si suivi par le pattern

\d(?=px) matches "5" in "5px"

(?!...)

Lookahead negatif : correspond si NON suivi par le pattern

\d(?!px) matches "5" in "5em"

(?<=...)

Lookbehind positif : correspond si precede par le pattern

(?<=\$)\d+ matches "50" in "$50"

(?<!...)

Lookbehind negatif : correspond si NON precede par le pattern

(?<!\$)\d+ matches "50" in "50"

\1

Correspond au meme texte que celui precedemment capture par le groupe n

(\w)\1 matches "ll" in "hello"

|

Correspond au pattern avant ou apres le pipe

cat|dog matches "cat" or "dog"

Drapeaux

g

Trouver toutes les correspondances, pas seulement la premiere

/a/g finds all "a" in "banana"

i

Correspondance insensible a la casse

/hello/i matches "Hello", "HELLO"

m

^ et $ correspondent au debut/fin de chaque ligne

/^abc/m matches at each line start

s

Le point (.) correspond aussi aux caracteres de retour a la ligne

/a.b/s matches "a\nb"

u

Activer la correspondance Unicode complete

/\u{1F600}/u matches emoji

Patterns courants

[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}

Pattern d'adresse e-mail

user@example.com

https?://[\w.-]+(?:\.[\w.-]+)+[\w.,@?^=%&:/~+#-]*

Pattern d'URL avec protocole

https://example.com/path

\b\d{1,3}(?:\.\d{1,3}){3}\b

Pattern d'adresse IPv4

192.168.1.1

\+?[\d\s()-]{7,15}

Pattern de numero de telephone (international)

+1 (555) 123-4567

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

Format de date ISO (AAAA-MM-JJ)

2026-03-23

#?[0-9a-fA-F]{3,8}

Pattern de code couleur hexadecimal

#ff6600, #f60

\d{4}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4}

Pattern de numero de carte de credit (16 chiffres)

4111 1111 1111 1111

[a-z0-9]+(?:-[a-z0-9]+)*

Pattern de slug URL (minuscules, avec tirets)

my-blog-post-title

[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}

Pattern UUID v4

550e8400-e29b-41d4-a716-446655440000

<([a-zA-Z][a-zA-Z0-9]*)\b[^>]*>.*?</\1>

Pattern de balise HTML avec contenu

<div class="x">text</div>

En savoir plus

Regex Cheat Sheet: The Complete Quick Reference for Developers

A searchable reference covering character classes, quantifiers, anchors, groups, and lookarounds. Find the regex syntax you need in seconds.

Why Every Developer Needs a Regex Quick Reference

Regular expressions are one of the most powerful tools in a developer's toolkit, yet they remain notoriously hard to memorize. Whether you are validating user input, parsing log files, or performing search-and-replace operations across a codebase, regex patterns can save hours of manual work. The problem is that the syntax is dense -- a single misplaced quantifier or forgotten escape can break an entire pattern.

5 min de lectureLire le guide complet