Regex Tester
Test regular expressions with real-time matching and group highlighting — 100% local
//g
Test String
0 bytes
About RegEx Tester
A regular expression is a compact pattern for matching text. They are used for validating input, searching logs, extracting values, and search-and-replace in editors and code. They are also easy to get subtly wrong.
This tester runs your pattern against sample text using the JavaScript regular expression engine built into your browser, and highlights matches as you type. Because it uses JavaScript syntax, features such as lookbehind depend on browser support, and some constructs from other languages (like possessive quantifiers) are not available.
Common use cases
- Building and debugging a pattern before putting it into code.
- Checking which parts of a log line a pattern captures.
- Testing validation rules against valid and invalid samples.
- Learning what flags such as g, i, and m change.
Frequently asked questions
- Why does my pattern only find the first match?
- Without the global (g) flag, JavaScript stops after the first match. Enable g to find all matches.
- Why does it behave differently in Python or PCRE?
- Regex flavors differ in syntax and features. Test with the engine your production code actually uses when it is not JavaScript.
- What is catastrophic backtracking?
- Nested repetition such as (a+)+ can make matching take exponential time on certain inputs. Simplify the pattern if the tester slows down.