Regex Tester
Fast, accurate and free online regex tester tool running directly in your browser.
-
1Enter data
Enter content, paste text or load a file from disk. -
2Click the button
The tool will immediately process your data in the browser. -
3Get the result
Copy the finished text or save the file to your device.
return "Result ready in 0.1s";
}
Rate this tool:
Related tools
Other tools you may find usefulRegular expression tester - checking and debugging regex patterns online
Regular expressions are one of the most useful and at the same time most complex technologies used in modern programming, database administration and task automation. Regex allows you to define complex text search patterns, thanks to which we can easily validate the correctness of entered data (e.g. format of e-mail address, zip code, password), search for specific keywords in large system logs or perform mass replacement of text fragments. Due to the difficult and unintuitive syntax, writing regular expressions often results in errors. Our free **online regular expression tester** (regex tester) is an interactive development tool that allows you to enter a regex pattern and test it on any text in real time. All matches, catch groups and syntax errors are immediately visualized.
This allows you to quickly test your expressions before implementing them into production code in PHP, JavaScript, Python or C#.
Regex essentials and common tokens
To help you build correct regular expressions, the table below provides a summary of the most commonly used syntax tokens that you can immediately test in our editor:
| Category | Character / Token | Match description and behavior | Sample regex | Match (example) |
|---|---|---|---|---|
| Character classes | \d |
Any digit (equivalent to[0-9]). |
\d{3} |
123, 789 |
| Character Classes | \in |
Alphanumeric character (letters, numbers, and underscore_). |
\w+ |
user_1, admin |
| Quantifiers | + |
One or more occurrences of the preceding element. | a+ |
a, aaa |
| Quantifiers | * |
Zero or more occurrences of the preceding element. | a* |
(empty string),aa |
| Anchors | ^and$ |
^mark the beginning of text (or line),$mark the end of text (or line). |
^Start |
Will only match "Start" at the beginning of a line. |
| Groups | (...) |
Capturing group – groups characters and remembers matching. | (pdf|docx) |
pdfordocx |
How do regular expression flags (modifiers) work?
Flags are special parameters placed at the end of a regular expression (after a closing slash, e.g./pattern/gim) that dramatically change the behavior of the matching engine. Our tester supports the most common flags:
- g (global) flag:Instead of stopping the search when the first match is found, the engine looks for all matches in the entire input text.
- i (case-insensitive) flag:Ignores case. The expression
/dog/ andwill match the words "dog", "Dog", as well as "DOG". - m (multi-line) flag:Changes the behavior of
^i$anchors. They look for the beginning and end of each line individually, not just the beginning and end of the entire input text. - s flag (dot-all):Causes the dot (
.), which normally matches every character except newlines, to also match newlines (\n). - Flag u (unicode):Enables full support for characters encoded in UTF-8 (e.g. Polish national characters, emojis).
How to use the regular expression tester?
User's Guide It only takes a moment to check your expression:
- Enter your regular expression:Enter your pattern in the upper text box. You don't need to add starting slashes (delimiters) - the system will handle it automatically.
- Select flags:Select the appropriate modifiers (e.g.
i,g,m) by clicking the flag icons next to the input field. - Paste test text:Enter any text you want to search for matches.
- Analyze results:The system will immediately highlight all matching text fragments. A panel with a detailed list of matches and values assigned to individual capturing groups will be displayed below. If you make a syntax error, the system will display a PCRE engine error message.
Frequently asked questions (FAQ)
How to check if a regular expression is valid using a tester?
Paste your pattern into the "Regex" field and enter sample data in the text field (e.g. correct e-mail address and incorrect e-mail address). If the tester correctly highlights only the correct email and no red syntax error message appears under the regex field, your expression is correct and works as intended.
What do the various regular expression flags (modifiers) mean?
Flags modify the search behavior:g(global) looks for all matches, not just the first one;i(case-insensitive) ignores differences between uppercase and lowercase letters;m(multiline) makes anchors work for every line;sallows dot to match newline transition characters; anduallows correct operation with the Unicode standard.
How to find and extract groups (capturing groups) using regex?
To create a capture group, surround part of the expression in round brackets(...), for example:(\d{2})-(\d{3})for a zip code. Our tester will highlight all the matched code, and in the side panel it will display the contents of each group: Group 1 (two digits) and Group 2 (three digits), which makes it easier to later extract data in the programming code.
What is the ReDoS (Regular Expression Denial of Service) error and how to avoid it?
ReDoS (Regex Denial of Service) occurs when you write an "exponentially bad" pattern (containing overlapping quantifiers, e.g.(a+)+). If there is no match, the regex engine starts checking millions of combinations (so-called catastrophic backtracking), which blocks the processor at 100%. Avoid nesting*, +quantifiers within other quantifier groups.
What is the difference between gredy and lazy matching?
The regex engine is greedy by default - it tries to match the longest possible string of characters. For example, for the text<b>one</b> two <b>three</b>the expression<b>.*</b>will match the entire string from the first to the last tag. Adding a question mark.*?changes the matching to lazy, so that the engine stops at the first closing tag it encounters, correctly matching two separate tags.