What the Regex Tester does
This page runs a JavaScript regular expression against text you paste and reports how many places that pattern matches, plus what it caught. It uses the browser's own RegExp engine, the same code behind String.match in Chrome, Edge and Firefox, so a pattern that works here behaves the same way inside your own scripts. Nothing leaves the page: the expression and the sample text are held in memory by the tab you have open.
Two buttons give two different answers. Test Match confirms the pattern compiles and counts the hits; Show Matches prints each matched substring on its own numbered line, which is what you want when a greedy pattern returns more than you expected. A pattern that will not compile returns the engine's own error text instead of a vague failure note, and the line under the result echoes the pattern and flags exactly as the tool parsed them.
How to use it
- Type the pattern bodyEnter the expression between the two slashes without writing the slashes yourself, because the tool supplies the delimiters when it builds the RegExp object. An empty box returns a request for input rather than a list of hits.
- Choose your flagsTick g to scan for every match, i to ignore letter case, m to treat each line as its own anchor point. The default state has g already on, and unticking it caps the reported count at one.
- Paste the test textDrop in a log snippet, a CSV field or a paragraph of prose. Matching runs against the whole textarea as a single string with its line breaks intact, so anchors behave the way they would in code.
- Count, then list hitsPress Test Match for a total and Show Matches for the substrings themselves. Clear wipes the pattern, the sample text and the result area in one click, and the sample is not restored afterwards.
Options and formats
Things to watch out for
Frequently asked questions
How do I test a pattern that contains slashes?
Do not wrap the expression in slashes yourself, because the tool adds those delimiters. Type the body only, so a date pattern becomes \d{2}/\d{2}/\d{4}, with each forward slash treated as a literal character to match rather than as a boundary between pattern and flags.
Why does my escaped pattern work in the console but fail here?
This box feeds text straight into the RegExp constructor, while a console or a source file may hold the pattern inside a string that consumes backslashes first. Anything needing double escaping in code, such as \s or \w, is typed once here. When a pattern fails, the error message names the position the parser gave up on.
Can I see where each match sits in the text?
No, the listing prints matched substrings in order without character offsets. A workaround is to widen the pattern with surrounding context, for example matching the label in front of a value as well, since the hits appear in the order the text runs, left to right and top to bottom.
Which regex features are available here?
Anything the installed browser supports: character classes, quantifiers, alternation, anchors, numbered and named groups, lookahead, and Unicode property escapes. Lookbehind and the dotAll flag work in current Chrome, Edge and Firefox builds but not in older Safari, so check there if the pattern is bound for production.
Does the tester show replacement output?
No, this page only matches. Substitution rules differ between languages, so a replacement string that works in JavaScript is not guaranteed to behave the same in Python, PHP or Java, and testing it here would give false confidence. Use a scratch script in the target language for replacements.
How much text can I paste in?
The textarea accepts whatever you paste, but every check rescans the entire string, so a multi-megabyte log will feel sluggish and a pathological pattern can lock the tab. For large files, narrow the input first with grep or an editor search, then paste the few relevant lines.