Trouver et remplacer texte utilisant un regular expression
Search pour motifs (non juste literal chaînes) en texte et remplacer matches avec un template ce peut référence capture groups.
- 1
Regex find-and-replace goes beyond literal substitution: it matches patterns (all email addresses, all numbers, repeated whitespace) and can use captured submatches in the replacement (e.g. swap first and last name).
- 2 Remplacement par regex →
Enter the regex pattern, flags (g for global, i for case-insensitive), and replacement template (use $1, $2 for capture groups). The tool shows all matches and the replaced output.
- 3 Testeur de regex →
Test the pattern first in the regex tester to confirm it matches what you expect before applying the replacement — this avoids catastrophic replacements on unexpected input.
Questions fréquentes
- What is the difference between $1 and \1 in replacement?
- $1 is the JavaScript replacement syntax; \1 is the sed/Perl syntax. Use $1 in JS-based tools. Named capture groups can be referenced as $<name> in modern JS.
- My regex is too greedy — how do I limit matches?
- Use non-greedy quantifiers (*?, +?) to match the shortest possible string, or replace .* with more specific character classes. Always test on edge cases — greedy regex is the most common source of unexpected replacements.
Workflows résolvant cette tâche
Outils associés
Remplacement par regex
Find and replace text using regular expressions. Gratuit, privé, 100% côté client. OUTIL
Testeur de regex
Test regular expressions with match highlighting, capture groups, and replace preview. Gratuit, privé et 100% côté client. OUTIL
Convertisseur de casse
Convert text between upper, lower, title, camel, pascal, snake, kebab, constant, and sentence cases. Gratuit, privé et 100% côté client. OUTIL