Toolzi LogoToolzi

Regex Tester

Test JavaScript regular expressions in real time — with live match highlighting and capture group display.

//g

Test String

ResultNo matches

What is a Regular Expression?

A regular expression (regex) is a sequence of characters that defines a search pattern. In JavaScript, regex is used with RegExp and string methods like match(), replace(), and split(). This tool runs entirely in your browser using the built-in JavaScript RegExp engine — no installation required.

Flag Reference

gGlobal

Finds all matches in the string instead of stopping at the first match.

iIgnore Case

Makes the pattern case-insensitive. /hello/i matches Hello, HELLO, and hello.

mMultiline

^ and $ match the start and end of each line, not just the whole string.

sDot All

The . metacharacter matches any character including newline (\n).

uUnicode

Enables full Unicode support including \u{XXXX} code point escapes and Unicode property escapes.

Common Regex Patterns

Use CasePattern
Email validation
^[\w.-]+@[\w.-]+\.\w{2,}$
Extract numbers
\d+
Extract URLs
https?://[^\s]+
Extract Korean
[가-힣]+
Remove whitespace
\s+

Frequently Asked Questions

What is a regular expression?
A regular expression (regex) is a pattern used to match character combinations in strings. It is used in JavaScript with methods like match(), replace(), test(), and split() for searching, validating, and transforming text.
What is the difference between the g and i flags?
The g (global) flag finds all matches in the string, not just the first. The i (ignoreCase) flag makes matching case-insensitive. You can combine them: /pattern/gi finds all matches regardless of case.
What are capture groups?
Capture groups are parts of a regex wrapped in parentheses (). They let you extract specific portions of a match. For example, (\d{4})-(\d{2})-(\d{2}) captures the year, month, and day from a date string separately.
What regex validates an email address?
A basic email validation pattern is ^[\w.-]+@[\w.-]+\.\w{2,}$. Paste it into the tester above to try it immediately.
How do I escape special characters?
Prefix any special regex character (. * + ? ( ) [ ] { } ^ $ | \) with a backslash (\) to match it literally. For example, use \. to match an actual period.
Is this the same as regex in other languages?
This tester uses JavaScript's built-in RegExp engine, which follows the ECMAScript standard. Most syntax is shared with other PCRE-based languages (Python, PHP, Java), but some advanced features may differ.

Related Tools