Testeur de regex
Texte & Code · Outil en ligne gratuit
Tester les regex avec surlignage des correspondances en direct.
Match Details
Surlignage en direct
Voyez les correspondances surlignées en temps réel pendant que vous tapez votre motif et votre texte de test.
Groupes de capture
Inspectez chaque groupe de capture pour chaque correspondance, avec position et valeur clairement affichées.
Support des drapeaux
Basculez les drapeaux g, i, m et s pour affiner votre motif.
Comment utiliser Testeur de regex
- 1Enter or paste your text or code into the input area.
- 2Choose the desired operation (format, convert, analyze, etc.).
- 3Click the action button to process.
- 4Copy the result from the output area.
Fonctionnalités
- ✓100% gratuit — sans inscription, sans abonnement, sans publicité
- ✓Fonctionne entièrement dans votre navigateur — vos données ne quittent jamais votre appareil
- ✓Rapide et léger — résultats instantanés
- ✓Multiplateforme — compatible ordinateur, tablette et mobile
Qu'est-ce que Testeur de regex ?
Regular expressions (regex) are a pattern-matching language defined by IEEE POSIX and ECMAScript specifications. They describe search patterns using metacharacters and literals. A Regex Tester lets you evaluate patterns against test strings in real time, highlighting matches and capturing groups.
Comment fonctionne Testeur de regex ?
The tester compiles your pattern into a state machine (NFA/DFA) and applies it to the input string. Flags modify behavior: g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode), y (sticky). Match results show position, captured groups, and named groups.
Cas d'usage courants
- ✓Form validation — emails, phone numbers, postal codes
- ✓Log parsing — extract fields from structured log lines
- ✓URL routing — match path patterns in web frameworks
- ✓Search and replace — batch text transformations
Regex vs String Methods
String methods (includes, indexOf, startsWith) are simpler and faster for exact matches. Regex is necessary for pattern-based matching (e.g., 'all emails in a document'). For simple checks, prefer string methods; for flexible patterns, use regex. Overly complex regex can cause ReDoS (Regular Expression Denial of Service).
Sécurité et confidentialité
This tool runs entirely in your browser. Beware of ReDoS when using regex in production — certain patterns (e.g., nested quantifiers like (a+)+) can cause catastrophic backtracking. Use timeouts or safe regex libraries for user-supplied patterns.
Détails techniques
Specifications: ECMAScript 2024 (MDN Reference), IEEE POSIX. Metacharacters: . * + ? ^ $ { } [ ] \ | ( ). Character classes: \d \w \s \b. Quantifiers: * (0+), + (1+), ? (0-1), {n,m}. Lookahead: (?=...) (?!...). Lookbehind: (?<=...) (?<!...). Named groups: (?<name>...).
Questions fréquentes
What is the difference between greedy and lazy quantifiers?
Greedy quantifiers (*, +) match as much as possible; lazy quantifiers (*?, +?) match as little as possible. Use lazy when you want the shortest match.
How do I test for a whole word?
Use word boundaries: \bword\b matches 'word' but not 'sword' or 'words'.
What are lookahead and lookbehind?
Lookahead (?=...) asserts what follows without consuming it. Lookbehind (?<=...) asserts what precedes. They are zero-width assertions useful for conditional matching.
Outils associés
Convertisseur de Chiffres Romains
Convertir entre chiffres romains et nombres arabes.
Texte ↔ Binaire
Convertir du texte en représentation binaire et inversement.
Validateur d'Email
Valider et normaliser les adresses e-mail.
Inverseur de Chaîne
Inverser le texte par caractères, mots ou lignes.
Évaluateur Mathématique
Évaluer des expressions mathématiques en toute sécurité.
Générateur de Slug
Convertir du texte en slugs adaptés aux URL.
Calculateur de Pourcentage
Calculer pourcentages, augmentations et réductions.
Calculateur d'ETA
Estimer le temps d'achèvement à partir de la progression et du débit.