Write a JavaScript regular expression, see every match marked in your text as you type, inspect its groups and preview a replacement.
//g| # | Position | Match | Groups |
|---|
| Token | Meaning |
|---|---|
. | Any character except a line break (any at all with the s flag) |
\d \w \s | Digit, word character (letter, digit, underscore), whitespace |
\D \W \S | The opposite of each of the above |
[abc] [^abc] [a-z] | One of, none of, a range |
^ $ | Start and end of the text (of each line with the m flag) |
\b | Word boundary |
* + ? | Zero or more, one or more, optional |
{3} {2,5} {2,} | Exactly 3, between 2 and 5, at least 2 |
*? +? | Lazy: as few as possible |
(abc) | Numbered group, used as $1 in a replacement |
(?<year>\d{4}) | Named group, used as $<year> |
(?:abc) | Group without capturing |
a|b | Either a or b |
(?=x) (?!x) | Followed by x, not followed by x |
(?<=x) (?<!x) | Preceded by x, not preceded by x |
$& $$ | In a replacement: the whole match, a literal dollar sign |
A regular expression is a tiny program that describes a shape of text: "three digits, a dash, four digits", "a word that starts with a capital letter", "everything between two quote marks". They are compact and powerful, and they are also easy to get slightly wrong. A pattern that looks right can miss the last line of a file, swallow far more than you meant because a .* was greedy, or match nothing at all because of one unescaped dot. This page lets you try a pattern against real sample text and see at once what it catches, before you put it into code, a spreadsheet formula, a log filter or a form validation rule.
/\d+/gi, the slashes are removed and the matching flag boxes are ticked for you.^ and $ work per line, s lets the dot cross line breaks, u turns on full Unicode handling, and y only matches at the exact position where the previous match ended.This tester uses the regular expression engine built into your browser, the same one that runs String.prototype.match and replace in JavaScript and Node.js, so what you see here is exactly what your JavaScript code will do. Other languages use similar syntax, but details differ: PHP and Python support some constructs JavaScript lacks, such as possessive quantifiers, and JavaScript has its own named group syntax for replacements. Test in the dialect you will run.
Some patterns can take an extremely long time on certain inputs. A classic example is (a+)+$ against a long run of the letter a followed by one other character: the engine tries an exponential number of ways to split the run before giving up. This is called catastrophic backtracking, and it has taken down real websites. To keep this page responsive, every test runs in a separate background worker with a 500 millisecond budget. If the pattern has not finished by then, the worker is stopped and you see a warning instead of a frozen tab. That warning is a useful signal in itself: a pattern that is slow here can be slow in production too. The match list stops at 1000 entries so a pattern that matches every character cannot flood the page.
Load the sample. The pattern (?<day>\d{2})-(?<month>\d{2})-(?<year>\d{4}) with the g flag finds three dates written day first, such as 05-03-2026. Each row in the table shows the three named groups. The replacement $<year>-$<month>-$<day> rewrites every date into the sortable year first form, 2026-03-05, which is how you would clean up a column of dates before importing it into a database.
Empty matches, such as those from \b or a pattern that can match nothing, are counted in the list but have nothing to mark in the text. The engine is whatever your browser ships, so very new syntax may not work in an older browser. Your pattern and text are processed only inside this browser tab. Ur Next Door does not receive, store or log any of it, so you can safely test patterns against private logs, customer exports or source code.