About Regex Tester
A regular expression is a pattern that describes a set of strings, used for validation, search, and text extraction. Small syntax mistakes are easy to make and hard to spot, so testing a pattern against real sample text before shipping it saves considerable debugging.
How to use
- Enter your regular expression pattern.
- Toggle flags such as global, case-insensitive, or multiline.
- Paste sample text and review the highlighted matches.
Frequently asked questions
What do the g, i and m flags do?
The g flag finds all matches rather than stopping at the first. The i flag makes matching case-insensitive. The m flag makes ^ and $ match at the start and end of each line instead of the whole string.
What is the difference between greedy and lazy matching?
Quantifiers such as * and + are greedy, consuming as much text as possible. Adding a question mark, as in *? or +?, makes them lazy so they match as little as possible.
Can I use these patterns in other languages?
This tester uses JavaScript regular expressions. Core syntax is shared across most languages, but lookbehind, named groups, and Unicode escapes vary, so verify against your target engine.