Bartel Media RegexTester
Free developer tool

The Free Regex Tester

Test and debug regular expressions with live match highlighting, capture groups, and replace mode. JavaScript regex engine, all flags supported. Client-side only — your data never leaves the browser.

Your pattern

Regular expression
/ /
Flags
g = global · i = ignore case · m = multiline · s = dot matches \n · u = unicode
Common patterns
Test string
Client-side · JavaScript RegExp · no server

Matches

Enter a pattern and test string to see matches.

Replace mode
01 — The basics

What is a regular expression?

A regular expression (regex) is a sequence of characters that defines a search pattern. You can use it to search, validate, extract, and transform text. Regex is supported in virtually every programming language — JavaScript, Python, PHP, Ruby, Go — and in most text editors and terminals.

A regex consists of literals (characters that match themselves), metacharacters (characters with special meaning like ., *, ?), and groups that capture sub-matches. Flags like g (global) and i (case-insensitive) modify how the engine searches.

// Match all email addresses in a string
/[\w.+-]+@[\w-]+\.[a-z]{2,}/gi
02 — How to use it

How to use this regex tester

  1. 1

    Enter your pattern

    Type your regular expression in the pattern field between the / delimiters. The tester updates live as you type.

  2. 2

    Toggle flags

    Enable or disable flags with one click — g for all matches, i for case-insensitive, m for multiline, s for dot-matches-newline, u for full Unicode.

  3. 3

    Paste your test string

    Enter the text you want to test against in the Test string field. All matches are highlighted and listed below instantly.

  4. 4

    Use replace mode

    Enter a replacement in the Replace field. Reference capture groups with $1, $2 or named groups with $<name>. The result updates live.

03 — FAQ

Frequently asked questions

What is a regular expression? +

A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. Regex can match, locate, and manipulate text. They are supported in virtually every programming language and text editor and are a fundamental tool for developers and data engineers.

What regex flavour does this tester use? +

This tester uses JavaScript's built-in RegExp engine (ECMAScript). It supports flags g (global), i (case-insensitive), m (multiline), s (dotAll — dot matches newline), and u (Unicode). If you need PCRE or Python regex, the syntax is largely compatible for common patterns, but some advanced features (like lookbehind length or possessive quantifiers) differ.

How do I use the g (global) flag? +

The g flag tells the engine to find ALL matches in the subject string, not just the first one. Without g, only the first match is returned. This tester enables g by default so you see all matches immediately.

What are capture groups? +

Capture groups are parts of a regex pattern wrapped in parentheses, e.g. (\d+). When the pattern matches, each group captures the text matched by that sub-expression. Capture groups are numbered from left to right: $1, $2, etc. Named groups use the syntax (?<name>...) and can be referenced by name.

How does replace mode work? +

Enter a replacement string in the Replace field. You can reference capture groups with $1, $2 (or $<name> for named groups). The full match is $&. For example, if your regex is (\w+)@(\w+) and replacement is $2/$1, the email user@domain becomes domain/user.

What does the dot (.) match? +

By default, the dot matches any character except a newline. With the s (dotAll) flag enabled, the dot also matches newline characters (\n, \r). This is useful when matching patterns that span multiple lines.

Is my text safe when using this tool? +

Yes. All regex processing runs entirely in your browser using JavaScript's native RegExp. Nothing is sent to any server. The tool works offline after the first load.

Is this regex tester free? +

Yes. Completely free, no sign-up, no usage limits. The site is funded by unobtrusive ads.