Toolypet
Ferramentas Dev/Testador de Regex

Testador de Regex

Testar e depurar expressões regulares com correspondência ao vivo

Padrão

String de teste

Correspondências (0 correspondências encontradas)

Nenhuma correspondência encontrada

Regular Expressions Guide

Learn how to test and debug regular expressions

What are Regular Expressions?

Regular expressions (regex) are patterns used to match character combinations in strings. They are powerful tools for searching, validating, and manipulating text data in programming.

How to Use This Tool

  1. Enter your regex pattern in the pattern field
  2. Select the flags you need (global, case-insensitive, multiline)
  3. Enter or paste your test text in the test string field
  4. View highlighted matches and match details in real-time

Pro Tips

  • Use the global flag (g) to find all matches, not just the first one
  • The multiline flag (m) makes ^ and $ match line starts/ends
  • Escape special characters like . * + ? with a backslash (\)

Browser Support

Regular expressions are natively supported in all modern browsers through JavaScript's RegExp object. This tool uses standard JavaScript regex syntax.

Perguntas frequentes

O que sao as flags g, i, m em expressoes regulares?

g (global) encontra todas as correspondencias, i (insensitive) ignora maiusculas/minusculas, m (multiline) faz ^ e $ corresponderem ao inicio/fim de cada linha. Multiplas flags podem ser usadas juntas.

Como buscar caracteres especiais literalmente?

Use barra invertida (\) para escape. Por exemplo, use \. para encontrar um ponto. Caracteres especiais incluem . * + ? ^ $ { } [ ] ( ) | \

Qual e uma regex adequada para validacao de email?

Validacao perfeita de email e muito complexa. Um padrao simples e ^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,}$, mas em servicos reais, confirmacao por envio de email e mais confiavel.

Qual a diferenca entre .* e .*?

.* e ganancioso (greedy) correspondendo o maximo possivel, .*? e preguicoso (lazy) correspondendo o minimo possivel. Ao extrair conteudo de tags HTML, usar <.*?> permite corresponder tags individuais.

Como usar captura de grupos em regex?

Use parenteses () para criar grupos que capturam partes correspondidas. Acesse resultados com groups[1], groups[2], etc. Para criar grupos sem captura, use (?:...)