About Regex Tester
Regex Tester checks a JavaScript pattern against sample text in your browser. Enter a regex, choose supported flags, and add the text you want to inspect. The tool highlights every match, reports match positions, and lists captured groups. Replace mode shows how your replacement text changes the input.
Use it to check a validation pattern, find repeated text, inspect capture groups, or confirm a replacement before adding code to an application. You can test short examples or longer text without installing software. Nothing is uploaded because matching runs in your browser.
The tool follows JavaScript RegExp behavior. That makes results useful for JavaScript work, but other languages can interpret the same pattern differently. Check your application's regex engine before using a pattern in production. This focused layout shows match, group, position, and replacement details without a full debugging workspace.
How to use it
- 1Enter a JavaScript regular expression in the pattern field.
- 2Select the flags you need, such as global, ignore-case, or multiline.
- 3Paste or type sample text into the test area.
- 4Review highlighted matches, positions, capture groups, and the replacement preview.
Worked example
Use the pattern \d+ with the global flag on this text: Order 123, shelf 45. The tool finds 123 at position 6 with length 3, and 45 at position 17 with length 2. Replacing each match with [number] produces: Order [number], shelf [number].
How it works
Tests a JavaScript regular expression with flags against text, highlights every match, lists groups and positions, and previews a replaceWorks in the browser with nothing to installSource: ECMAScript Language Specification, RegExp ObjectsMDN JavaScript Regular Expressions GuideUnicode Technical Standard #18, Unicode Regular Expressions. Last checked 4 November 2026.
What it is good for
- See every match highlighted in your sample text.
- Inspect capture groups and exact match positions.
- Preview JavaScript replacement results before changing code.
- The tester uses JavaScript RegExp behavior, not PCRE2, Python, .NET, Java, or Go rules.
- It does not provide a step-through debugger or a multi-case test suite.
Questions people ask
What is a regex tester?
A regex tester runs a regular expression against sample text. It shows matches, capture groups, positions, errors, and replacement results.
What inputs does this regex tester use?
Enter a JavaScript regex pattern, sample text, and any flags you need. You can also enter replacement text to view a replacement preview.
What does the g flag do?
The g flag enables global matching. The tester then finds multiple non-overlapping matches instead of stopping after the first match.
What do the i, m, and s flags do?
The i flag ignores letter case. The m flag changes how ^ and $ work across lines, while s lets a dot match newline characters.
What is a capture group?
A capture group is text matched inside parentheses, such as (abc). The tester lists each captured value so you can check what your pattern stored.
Why does my regex work here but not in my application?
Your application may use another regex engine, flag set, escaping rule, or replacement syntax. This tool tests JavaScript RegExp behavior, so compare it with your application's engine.
Help keep every tool free
FreeToolr stays free because people help it grow. Share a tool you like, tell us what to build next, or support us on Ko-fi.