Testador de Expressões Regulares

Free online regular expression testing tool. Real-time match highlighting, capture group extraction with details, regex replace mode, 50+ common patterns library, and syntax explanation. All processing is done client-side — your data never leaves your browser.

/ /

Test Text

Match Result

Matches: 0 Groups: 0 Time: 0ms
🔍 Regex Explanation
📋 Match Details (Capture Groups)
Capture group details will appear here after running a test.

📖 Common Patterns Library

📘 Regex Syntax Reference

Pattern Description Example
.Matches any single character (except newline)a.b matches "acb", "a2b"
\dMatches a digit (0-9)\d{3} matches "123"
\wMatches a word character (letter, digit, underscore)\w+ matches "hello"
\sMatches whitespace (space, tab, newline)\s+ matches consecutive whitespace
\bWord boundary\bword\b matches exact word
^Matches start of string/line^Hello matches "Hello" at the start
$Matches end of string/lineend$ matches "end" at the end
*Matches 0 or more of preceding elementab*c matches "ac", "abc", "abbc"
+Matches 1 or more of preceding elementab+c matches "abc", "abbc"
?Matches 0 or 1 of preceding element (optional)colou?r matches "color", "colour"
{n}Matches exactly n times\d{4} matches 4 digits
{n,}Corresponde pelo menos n vezes\d{2,} matches 2+ digits
{n,m}Corresponde entre n e m vezes\d{2,4} matches 2-4 digits
[abc]Conjunto de caracteres: corresponde a qualquer caractere do conjunto[aeiou] matches any vowel
[^abc]Conjunto de caracteres negado: corresponde a qualquer caractere que NÃO esteja no conjunto[^0-9] matches non-digit
(padrão)Grupo de captura, extrai a subcadeia correspondente(\d+) captures digit sequence
(?:padrão)Grupo sem captura, grupos sem captura(?:\d+) groups but does not capture
a|bOR, matches either a or bcat|dog matches "cat" or "dog"
(?=...)Positive lookahead\d(?=px) digit followed by "px"
(?!...)Negative lookahead\d(?!px) digit NOT followed by "px"
(?<=...)Positive lookbehind(?<=\$)\d+ digits preceded by $
(?<!...)Negative lookbehind(?<!\$)\d+ digits NOT preceded by $

What is a Regular Expression?

A regular expression (regex / regexp) is a sequence of characters that defines a search pattern. It is widely used for text search, validation, replacement, and data extraction. Almost every major programming language (JavaScript, Python, Java, PHP, etc.) supports regular expressions.

Features

  • Real-time match highlighting — See all matches highlighted instantly as you type your pattern and test text
  • Flag toggles — Supports g (global), i (case-insensitive), m (multiline), s (dotAll), u (Unicode)
  • Match details with capture groups — Position, content, and capture groups for each match at a glance
  • Replace mode — Enter a replacement template with $1, $& back-references support
  • Syntax explanation — Break down your regex pattern into human-readable explanations, token by token
  • 50+ common patterns library — Number validation, character validation, text processing, and programming patterns — one-click to apply
  • Built-in syntax reference table — Quickly look up common metacharacters and regex rules

Common Use Cases

  • Form validation: email, phone number, URL, ID card format verification
  • Text search and replace: batch replace text matching specific patterns
  • Log analysis: extract IPs, timestamps, and error messages from log files
  • Data extraction: extract specific fields from HTML, JSON, and other structured text
  • Code refactoring: batch rename variables, reformat code

Tip: Start by selecting a common pattern or typing a regex, then enter test text — results update in real time.