Test Regex Patterns Online
Test regular expressions against any string with live match highlighting, flag toggles, and a numbered match list.
What is Test Regex Patterns?
A regular expression (regex) is a compact, declarative pattern language used to describe sets of strings. Originating with Stephen Kleene in the 1950s and popularized in Unix tools like grep, sed, and awk, regex syntax now powers search and validation across nearly every modern programming language. Patterns combine literal characters with metacharacters — such as ., *, +, ?, [ ], ( ), and | — to express choices, repetition, and grouping. A regex tester evaluates a pattern against a test string in real time, highlights every match, lists capture groups, and reports flag behavior (case-insensitive, global, multiline, dotall) so developers can iterate before embedding the pattern into code.
How to use
- Enter a regular expression pattern in the pattern field.
- Toggle flags (g, i, m) and type or paste your test string below.
- Matches are highlighted in real time with a numbered list of each match and its position.
Frequently asked questions
What is a regular expression?
A regular expression (regex) is a sequence of characters that defines a search pattern. It is used for string matching, searching, and text manipulation in programming languages, text editors, and command-line tools.
What do regex flags do?
Flags modify how the regex engine processes the pattern. g (global) finds all matches instead of stopping at the first. i (case insensitive) ignores letter case. m (multiline) makes ^ and $ match line boundaries instead of just string boundaries.
How do I match a whole word?
Use word boundary anchors: \bword\b matches "word" only when it appears as a complete word, not as part of another word like "password" or "wording".
What's the difference between greedy and lazy matching?
Greedy quantifiers (*, +, {n,m}) match as much text as possible. Lazy quantifiers (*?, +?, {n,m}?) match as little as possible. For example, on "onetwo", the greedy pattern .* matches the entire string, while .*? matches only "one".
Last updated
Powered by maratool