Find and Replace Text
Replace text everywhere at once, with case options and regex support.
Test a regular expression against sample text and see every match.
No surrounding slashes needed.
| # | Match | Index | Groups |
|---|
| \d \w \s | Digit, word character, whitespace |
|---|---|
| \D \W \S | The opposite of each |
| . | Any character except a newline |
| ^ $ | Start and end of the text, or of a line with the m flag |
| \b | Word boundary |
| * + ? | Zero or more, one or more, optional |
| {2,5} | Between two and five times |
| [abc] [^abc] | Any of these, none of these |
| (x) (?:x) | Capture group, non-capturing group |
| (?<name>x) | Named capture group |
| a|b | Either a or b |
Regex Tester lets you write a regular expression and immediately see what it matches in a block of sample text. Matches are highlighted as you type, so building a pattern becomes a conversation with the text rather than a guessing game followed by a run.
Below the highlighted text, every match is listed with its position and its capture groups. Capture groups are the bracketed parts of a pattern, and they are where most of the real work happens: a pattern that matches a date is useful, but a pattern that captures the day, month and year separately is what lets you reformat it.
All the standard JavaScript flags are available as switches: global for every match rather than the first, case-insensitive, multiline so that the start and end anchors apply per line, dot-all so a full stop also matches newlines, unicode, and sticky. Invalid patterns produce the browser's own explanation rather than silence, and a cheat sheet of common tokens sits alongside for when you cannot remember whether it is \d or \w you want.
The regex tester is used by writers, developers, students, marketers and anyone else who needs the job done once without installing software. Common cases include:
JavaScript, because the matching is done by your browser's own engine. That covers the great majority of common syntax, but a few features found in other languages, such as lookbehind in older browsers or possessive quantifiers, may behave differently.
The global flag is off. Without it, the engine stops after the first match. Switch on g to find every occurrence.
Multiline makes the caret and dollar anchors apply at the start and end of each line rather than the whole text. Dot-all makes a full stop match newline characters too. They solve different problems and are often confused.
A bracketed part of a pattern captures what it matched so you can use it afterwards. Naming one with the syntax for named groups makes the result readable, which matters when a pattern has five groups and you cannot remember which is which.
A global pattern that can match nothing will loop forever on the same position. The tool detects that and stops, so your browser tab does not freeze.
No. Matching runs in your browser, so log extracts and real data stay on your device.
If the regex tester is not quite what you need, these other free tools solve closely related problems.
Replace text everywhere at once, with case options and regex support.
Tidy messy pasted text: extra spaces, empty lines, breaks and special characters.
Pretty-print and validate JSON, with the exact line and column of any error.
Split a URL into every component, including a table of query parameters.
Spot every added, removed and unchanged line between two versions.