Saltar al contenido
uencoder

Buscar y reemplazar texto usando un regular expression

Search para patrones (no solo literal cadenas) en texto y reemplazar matches con un template ese puede referencia 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
    Reemplazo con 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. 3
    Probador 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.

Preguntas frecuentes

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.

Flujos que resuelven esta tarea

Herramientas relacionadas