Regex Tester
Test, debug, and learn regular expressions in real time. No data leaves your browser.
Regex Cheat Sheet
Character Classes
. | Any character (except newline) |
\\d | Digit (0-9) |
\\D | Not a digit |
\\w | Word character (a-z, A-Z, 0-9, _) |
\\W | Not a word character |
\\s | Whitespace |
\\S | Not whitespace |
[abc] | Any of a, b, or c |
[^abc] | Not a, b, or c |
[a-z] | Character range a to z |
Quantifiers
* | 0 or more |
+ | 1 or more |
? | 0 or 1 (optional) |
{n} | Exactly n times |
{n,} | n or more times |
{n,m} | Between n and m times |
*? | Lazy (0 or more) |
+? | Lazy (1 or more) |
Anchors & Boundaries
^ | Start of string / line |
$ | End of string / line |
\\b | Word boundary |
\\B | Not a word boundary |
Groups & Lookaround
(abc) | Capturing group |
(?:abc) | Non-capturing group |
(?<name>abc) | Named group |
\\1 | Backreference to group 1 |
(?=abc) | Positive lookahead |
(?!abc) | Negative lookahead |
(?<=abc) | Positive lookbehind |
(?<!abc) | Negative lookbehind |
a|b | Alternation (a or b) |
What is a Regular Expression?
A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. Originally developed for Unix text processing in the 1970s, regex is now supported in virtually every programming language and text editor. It's used for pattern matching, validation, search-and-replace, and text extraction.
Common Use Cases for Regex
- Form validation: Check if user input matches expected formats like emails, phone numbers, or zip codes.
- Data extraction: Pull specific values like dates, URLs, or IDs from unstructured text or log files.
- Search and replace: Transform text in bulk — rename variables, reformat dates, or clean up data.
- Log analysis: Filter and parse server logs to find errors, IP addresses, or request patterns.
- Web scraping: Extract content from HTML when a full parser is overkill.
Regex Flags Explained
| Flag | Name | Effect |
|---|---|---|
g |
Global | Find all matches, not just the first one |
i |
Case Insensitive | Match uppercase and lowercase letters equally |
m |
Multiline | Make ^ and $ match start/end of each line |
s |
DotAll | Make . match newline characters too |
u |
Unicode | Enable full Unicode support for patterns |
Frequently Asked Questions
What is a regex tester?
A regex tester is an online tool that lets you write a regular expression pattern and test it against a sample string in real time. It highlights matches, shows captured groups, and reports match positions — helping you build and debug patterns without writing code.
How do I use a regular expression tester?
Type your regex pattern in the pattern input field, enter your test string in the text area, and toggle flags like global (g), case-insensitive (i), or multiline (m). Matches are highlighted instantly as you type — no submit button needed.
What regex flags are available?
The most common flags are: g (global), i (case-insensitive), m (multiline), s (dotAll — makes . match newlines), and u (unicode). You can combine multiple flags to refine your search behavior.
What is the difference between regex tester and regex101?
Both are online regex testing tools. This regex tester runs entirely in your browser with zero server calls, providing instant results with match highlighting, group captures, and a replace mode. It also includes a quick-reference panel and cheat sheet for learning regex syntax.
Can I use regex to find and replace text?
Yes. Switch to Replace mode, enter your replacement pattern (supporting backreferences like $1, $2 for captured groups), and see the transformed output instantly. This is useful for batch text transformations, data cleanup, and reformatting.
Why is my regex not matching anything?
Common reasons include: forgetting the global (g) flag so only the first match is found, not escaping special characters like . or (, case sensitivity (toggle the i flag), or an incorrect pattern. Check the error message for syntax issues and reference the cheat sheet.
Is my data safe when using an online regex checker?
This regex tester runs entirely in your browser using JavaScript. No data is sent to any server. Your patterns and test strings never leave your device, making it completely safe for testing with sensitive data.
Related Tools
- JSON Formatter & Validator — Format, validate, and minify JSON online.
- Base64 Encoder / Decoder — Encode and decode Base64 strings.
- URL Encoder / Decoder — Encode and decode URL components.
- Hash Generator — Generate MD5, SHA-1, SHA-256, and other hashes.