Zum Inhalt springen
uencoder

Finden und ersetzen Text mit ein regular expression

Search für Muster (nicht gerade literal Zeichenketten) in Text und ersetzen matches mit ein template das kann Referenz capture groups.

  1. 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. 2
    Regex-Ersetzung →

    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. 3
    Regex-Tester →

    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.

Häufige Fragen

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, die diese Aufgabe lösen

Verwandte Tools