Text Tools
Find and Replace Text — Bulk Search & Replace
Replace words and phrases throughout a whole document in one click — with match-case, whole-word and regular expression options, and an exact replacement count.
Open toolRegular expressions are the sharpest tool in the text toolbox — and the easiest to get silently wrong. This free regex tester runs your pattern against your own text live, in your browser: matches light up in place, and the match list shows every match with its starting position and its capture groups, so you can see exactly what the pattern caught and just as importantly what it missed. Toggle the flags — global, case-insensitive, multiline, dot-all and the rest — and watch the result change, or start from the pattern library, which covers the everyday jobs: email addresses, URLs, dates, phone numbers and hex colours. The cheat sheet below the tester explains every symbol, and gives an honest account of where the JavaScript regex flavour differs from Java and Python, because this tester runs the engine built into your browser. Nothing you paste is uploaded: test log excerpts, drafts and data extracts safely. When a pattern is finally right, the Find and Replace tool on this site applies the same style of pattern across a whole document in one pass.
This tester runs your browser's JavaScript (ECMAScript) regex engine, live on this device — your text is never uploaded. Java and Python differ in a few syntax corners; the cheat sheet below spells out exactly where.
| Pattern | Means | Pattern | Means |
|---|---|---|---|
. | any character except newline | \d / \D | digit / non-digit |
\w / \W | word character (letter, digit, _) / non-word | \s / \S | whitespace / non-whitespace |
^ / $ | start / end of string (of line, with flag m) | \b / \B | word boundary / non-boundary |
* + ? | 0 or more · 1 or more · 0 or 1 | {n} {n,} {n,m} | exactly n · at least n · between n and m repeats |
[abc] / [^abc] | one of a, b, c / any except a, b, c | [a-z] | a character range |
(abc) | capture group | (?:abc) | group without capturing |
(?<name>abc) | named capture group | a|b | a or b (alternation) |
(?=abc) / (?!abc) | lookahead: followed by / not followed by abc | (?<=abc) / (?<!abc) | lookbehind: preceded by / not preceded by abc |
\. \* \\ | escaped literals — a real dot, star, backslash | *? +? | lazy versions — match as little as possible |
This tester uses the JavaScript (ECMAScript) engine built into your browser — the right reference when you are writing patterns for web forms, JavaScript or TypeScript. Patterns mostly travel well between engines, but four corners differ and they are exactly the ones that waste afternoons. Named groups: JavaScript and Java both write (?<name>...); Python writes (?P<name>...). Flags: JavaScript puts them after the pattern (as the toggles above do); Python and Java usually pass them separately (re.IGNORECASE, Pattern.CASE_INSENSITIVE) or inline as (?i) — and Python's verbose x flag has no JavaScript equivalent. Digits: JavaScript's \d is strictly [0-9], while Python 3 matches Unicode digits by default, so a pattern tested here can match more (or less) there. Lookbehind: modern browsers support it; Python requires the looked-behind text to be a fixed width; older Java versions restrict it too. If a pattern must run in several languages, test it in each one — this page covers the JavaScript side exactly.
Two habits that save debugging time wherever you work: test against text that should fail as well as text that should match, and paste the pattern into the Find and Replace tool when you are ready to apply it across a whole document.
The pattern \b\d{3}-\d{4}\b run against the text “Call 555-0134 or 555-9876” finds both number fragments and lists each with its starting position. Switch the global flag off and only the first is reported — the clearest demonstration of what that flag does.
JavaScript's built-in ECMAScript engine — the one in your browser, which is why testing is instant and nothing is uploaded. Most patterns behave identically in Java and Python, but named-group syntax, flag handling and Unicode digits differ; the cheat sheet section on this page lists the exact differences.
The global (g) flag is off. Without it, a search stops at the first match by design — useful in code that only needs one answer. Tick the g flag in the flags row and the tester will find, highlight and list every match in the text.
A match with no characters in it. Patterns built from anchors and lookarounds — ^, \b, (?=...) — match a position rather than text, so they can succeed at a place while consuming nothing. The tester counts them, flags them in the status line, and shows them as a thin marker in the highlight so they cannot quietly inflate your results.
Load the Email address pattern from the library: it checks the practical shape — something, an @, a domain, a dot, a top-level part. No regex can prove an address is real or deliverable; the only true test is sending a message and watching for a bounce. Use the pattern to catch typos and malformed entries, not as proof.
Usually one of three corners: Python writes named groups as (?P<name>...) where JavaScript and Java use (?<name>...); Python's \d matches Unicode digits while JavaScript's is only 0–9; and flags are passed differently (re.IGNORECASE or inline (?i) instead of trailing letters). Test mission-critical patterns in the engine that will actually run them.
No. Matching runs entirely in your browser using its built-in regex engine; the pattern and the test text never leave this page. That makes the tester safe for log files, customer data extracts and unpublished drafts.