ESC

Regular Expression Tester

/ / g

Quick Patterns

Statistics

Total Matches 0
Groups 0
Execution Time 0ms
All regex processing happens in your browser. No data is sent to any server.

0

Total Matches

0

Groups

0ms

Execution Time

Usage Examples

Email Validation

Validate and extract email addresses from text using regex patterns.

/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g
URL Extraction

Find and extract URLs from any text content using regular expressions.

/https?:\/\/[\w\-]+(\.[\w\-]+)+/g
Phone Number Parsing

Parse and validate phone numbers in various international formats.

/\+?\d{1,4}[-.\s]?\(?\d{1,3}\)?[-.\s]?\d{1,4}/g

Features

Match Highlighting

Visual highlighting of all matches in the test string

Regex Flags

Support for global, case-insensitive, multiline and dotAll flags

Quick Patterns

Pre-built patterns for common use cases like email, URL, phone

Group Details

View capture groups and named groups for each match

Statistics

Match count, group count and execution time metrics

Real-Time Testing

Results update automatically as you type

Error Handling

Clear error messages for invalid regex patterns

Privacy

All processing in browser, no data sent to servers

How to Use?

1

Enter Pattern

Type your regular expression pattern in the pattern input field.

2

Set Flags

Choose the appropriate flags: global, case-insensitive, multiline, dotAll.

3

Enter Test String

Paste or type the text you want to test against your regex pattern.

4

View Results

See highlighted matches and detailed match information including groups.

5

Use Quick Patterns

Try pre-built patterns for common tasks like email or URL validation.

Frequently Asked Questions

A regular expression is a sequence of characters that defines a search pattern. You can use it to find text that matches a pattern, validate that input conforms to a format, extract specific parts of a string, or replace portions of text. Examples: /\d{4}-\d{2}-\d{2}/ matches dates in YYYY-MM-DD format; /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/ validates email addresses; /https?:\/\/[^\s]+/g finds all URLs in a block of text. Regex is supported natively in JavaScript, Python, PHP, Ruby, Java, Go, and virtually every other programming language.

g (global): find all matches, not just the first one. Without g, the regex returns only the first match. i (case insensitive): "hello" matches "Hello", "HELLO", "hElLo". m (multiline): ^ and $ match the start/end of each line rather than the entire string. Without m, ^ only matches the very start of the input. s (dotAll / single-line): the dot . normally matches any character except newline — with s, it matches newlines too. This tool is JavaScript-based, so the available flags are those supported by JavaScript's RegExp implementation.

Numbered capture groups: parentheses () in your pattern capture matched text that you can reference by index: $1, $2, etc. For example, (\d{4})-(\d{2})-(\d{2}) on "2026-03-15" captures year as group 1, month as group 2, day as group 3. Named capture groups: (?<name>pattern) assigns a label to a group, making it accessible as match.groups.name in JavaScript. Example: (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}). Named groups are more readable and do not break when you add groups elsewhere in the pattern. Non-capturing groups (?:pattern) group without capturing, useful when you need grouping for alternation (a|b) but not the match.

The most common causes: (1) Missing g flag — without it, only the first match is found, and the counter shows 1 when you expected more. (2) Unescaped special characters — in regex, . matches any character but \. matches a literal period. Similarly \( \) for parentheses, \[ \] for brackets. (3) Wrong anchors — ^ and $ without the m flag match the whole string start/end, not per-line. (4) Quantifier greediness — .* matches as much as possible, often consuming what you wanted to capture. Use .*? for non-greedy. (5) The pattern requires more input than you provided — run a quick sanity check with a simpler sub-pattern.

Catastrophic backtracking occurs when a regex with nested quantifiers causes exponential time complexity on certain inputs. The classic example: (a+)+ applied to "aaaaaab" — the engine tries every possible way to split the a's among nested groups before failing, causing the pattern to hang. You can trigger this in the tester to see it. Prevention: avoid nested quantifiers on overlapping patterns, use possessive quantifiers or atomic groups where supported, and be specific about what each part matches. If you see the tester become unresponsive, your pattern likely has catastrophic backtracking — refresh the page and simplify the pattern.

Lookaheads and lookbehinds match a position based on what precedes or follows, without including that context in the match. Positive lookahead (?=...): \w+(?=@) matches the word before an @ without including @. Negative lookahead (?!...): \d+(?!\.\d) matches a number not followed by a decimal. Positive lookbehind (?<=...): (?<=\$)\d+ matches digits preceded by $. Negative lookbehind (?<!...): (?<!\d)\d+ matches digits not preceded by a digit. JavaScript supports all four since ES2018, including variable-length lookbehind in modern browsers.

Yes. This tool uses JavaScript's built-in RegExp engine, so all patterns and flags are JavaScript-specific. The JavaScript flavor closely matches Perl-compatible regex (PCRE) but has some differences: no possessive quantifiers (a++ syntax), limited lookbehind (variable-length lookbehind added in ES2018), and different Unicode handling. If you are writing Python regex, note that Python uses \A and \Z instead of ^ and $ for string anchors, and raw strings (r"pattern") avoid double-escaping. For PHP (PCRE) or Java regex, the patterns are largely compatible with JavaScript but check delimiter and flag syntax.

No. All regex matching runs in your browser using JavaScript's native RegExp engine. Your patterns and test strings never leave your device.

Online Regex Tester and Debugger

Regex is that thing everyone googles every single time. Paste your pattern, paste your text, and see matches highlighted instantly. No more guessing if your pattern is right - you'll know in real time.

Regular Expression Pattern Matching

Debugging regex is painful without the right feedback. This tester shows you capture groups, match positions, and execution stats so you can figure out exactly why your pattern isn't catching what you expect.

Quick Regex Patterns for Common Tasks

Can't remember the email validation pattern? Or how to match a URL? Hit the quick patterns and load common regex for emails, URLs, phone numbers, IPs, and dates with one click. Saves you a Stack Overflow trip.

Security and Privacy

Your data security is our priority

Local Processing

All processing happens in your browser

No Data Transfer

Your data is not sent to our servers

No Data Storage

No data is stored or shared

SSL Encryption

SSL encryption for secure connection

Next Step

Also on MoreOnlineTools