Text

Regex Tester / Find & Replace

Test regular expressions against real text: highlighted matches with parsed capture groups, or replace matches with new text.


                        

                        

A regular expression (regex) is a compact language for describing patterns in text — for searching, validating a format, or replacing matches. This tool highlights matches in real text as you type the pattern, breaks out capture groups, and supports a find-and-replace mode.

How to use it

Common uses

Things to keep in mind

Greedy quantifiers (*, +) grab as many characters as possible — add ? for the minimal match instead (e.g. .*? instead of .*).

Syntax varies slightly between languages — an expression that works here (a JavaScript engine) may need adjusting for PCRE, .NET, or Python.

Article about this tool: Regular expressions: basic syntax and common patterns

Frequently asked questions

Which regex engine is used?

The tool uses JavaScript's regex engine, not PCRE, so some PCRE-specific syntax (like recursive assertions or certain possessive matching modes) won't work here; common flags like g, i, m, s, and u are supported.

What's the difference between greedy and lazy quantifiers, and between Test and Replace?

A greedy quantifier like * or + captures as much text as possible, while its lazy version (*?, +?) stops as early as possible; as for modes, Test highlights matches and lists capture groups (including named ones), and Replace applies replacement text, with references like $1, to each match.

Are my text and expression sent to a server?

No, regular expression evaluation happens entirely client-side in your browser, nothing is transmitted online.

What is catastrophic backtracking?

Nested quantifiers like (a+)+ can, on certain inputs, force the engine to try an exponential number of combinations — the page or script "freezes" on what looks like a simple expression. This is a real vulnerability class (ReDoS), so complex nested quantifiers should be stress-tested against long near-match strings.

Why does my expression work in one programming language but not another?

Regex syntax isn't fully standardized: PCRE (PHP and many other languages), .NET, Python's re, and JavaScript have subtle differences in support for certain constructs (like look-behind or named groups) — an expression written for one engine doesn't always work unchanged in another.

Articles: Text

Case Converter: why different naming styles exist

Why one project writes variables in camelCase but files in kebab-case, and where these rules came from.

Text Diff: how algorithms find the difference between two texts

How a diff algorithm finds the minimal set of changes between two versions of a text.

Sorting and deduplicating lines: why it matters

Why numeric sorting putting "10" before "9" is a mistake, and how to avoid it.

String Escape: why the same text needs escaping differently

Why the same quote character gets escaped differently in a JS string, JSON, and a shell command.

CRLF vs LF: why line ending characters still matter

Why a file written on Windows can show as "entirely changed" in git on Linux.

Counting characters and words: why it's not always trivial

Why an emoji or an accented character can count as several characters at once.

Lorem Ipsum: where the placeholder text came from and why it exists

Why designers deliberately use "nonsense" text instead of real content in mockups.

Slugify: turning arbitrary text into a URL

How a title like "Hello, World!" turns into a URL-safe string like hello-world.

Markdown: why plain-text syntax beat rich text editors

Why developers choose to write documentation in Markdown instead of a rich text editor.

Whitespace and invisible characters: the hidden cause of weird bugs

Why two strings that look identical can fail to match because of an invisible character.

Text Reverse: why "reversing text" is harder than it sounds

Why a naive string reversal can turn an emoji into unusable bytes.

Text frequency analysis: why count how often words repeat

How letter frequency in ciphertext helps crack the simplest substitution ciphers.