Pulsars

Regex Tester Online — Test & Debug Regular Expressions

Common Patterns
Social Media Usernames
//gm
2 matches
Highlighted Matches
john@example.com
invalid@
test.user@domain.co.uk
@missing.com
Match Details
#1john@example.comindex 0
#2test.user@domain.co.ukindex 26

A regular expression (regex) is a sequence of characters that defines a search pattern, used for string matching, validation, and text extraction. Regex syntax — standardized in POSIX and extended by PCRE (Perl Compatible Regular Expressions) — includes quantifiers (+, *, ?), character classes ([a-z], \d, \w), anchors (^, $), and capture groups. Regular expressions are supported natively in JavaScript, Python, Java, Go, and virtually every modern programming language.

What is a Regular Expression?

A regular expression (regex) is a pattern that describes a set of strings. It's the standard tool for searching, validating, and transforming text in programming. Regex is supported in every major language — JavaScript, Python, Java, Go, Rust, PHP — and in tools like grep, sed, and most text editors.

A regex combines literal characters with special metacharacters. For example, \d3-\d4 matches a 3-digit number, a dash, and a 4-digit number (like a US phone suffix).

What are the most common regex syntax elements?

Pattern Meaning
.Any character (except newline)
\dDigit (0-9)
\wWord character (a-z, A-Z, 0-9, _)
\sWhitespace (space, tab, newline)
^Start of string/line
$End of string/line
*0 or more
+1 or more
?0 or 1 (optional)
{n,m}Between n and m times
[abc]Character class (a, b, or c)
(abc)Capture group
a|bAlternation (a or b)

What are the most common regex patterns?

If you work with scheduled tasks, our cron expression generator can help you build crontab schedules visually. For encoding data, check the Base64 encoder.

Frequently Asked Questions

What is a regular expression?

+

A regular expression (regex) is a sequence of characters that defines a search pattern. It's used in programming, text editors, and command-line tools to find, match, validate, and replace text. For example, the regex \d{3}-\d{4} matches patterns like 123-4567. Regex is supported in virtually every programming language including JavaScript, Python, Java, Go, and Rust.

What does the g (global) flag do?

+

The global flag tells the regex engine to find all matches in the input string, not just the first one. Without the g flag, the regex stops after finding the first match. Other common flags include i (case insensitive), m (multiline — ^ and $ match line boundaries), and s (dotAll — . matches newline characters).

How do capture groups work in regex?

+

Parentheses () in a regex create capture groups. When the regex matches, each group captures its portion of the matched text separately. You can reference groups by index: group 0 is the full match, group 1 is the first set of parentheses, etc. Named groups (?<name>...) let you reference captures by name instead of index.

What is catastrophic backtracking (ReDoS)?

+

Catastrophic backtracking occurs when a regex pattern causes the engine to explore an exponential number of paths on certain inputs. This can freeze your browser or crash a server. Common culprits are nested quantifiers like (a+)+ or (a|a)+. This tool includes a timeout guard to prevent such issues. In production, always test your regex with adversarial inputs.

Can I use this tool for JavaScript regex?

+

Yes, this tool uses JavaScript's native RegExp engine directly in your browser. The syntax and behavior match exactly what you'd get in Node.js, Chrome, Firefox, or any JavaScript runtime. The flags g, i, m, s, and u are all supported.

Related Tools