Regex Tester
Test JavaScript regular expressions with live match highlighting and group capture.
Regex Tester Features
This RegExp tester executes standard JavaScript RegExp patterns against your text in real time. It highlights exactly where your patterns match the test string and breaks down capture groups individually. Every keystroke triggers a fresh match, so you get instant feedback as you build and refine your expression. The tool runs entirely in your browser — no data is ever sent to a server, making it safe for testing against sensitive or private data.
Regex Flags Explained
Flags modify how your pattern is applied to the test string. You can toggle any combination of the following flags via the checkboxes next to the pattern input:
g— Global (enabled by default): Find all matches in the text rather than stopping after the first one. Without this flag, only the first match is returned.i— Case-insensitive: Ignores letter casing when matching —[a-z]will also matchAthroughZ, and literal characters likehellowill matchHello,HELLO,hELLo, etc.m— Multiline: Changes the behavior of the^and$anchors so they match the start and end of every line, not just the start and end of the entire string. Essential when working with multi-line text such as log files or CSV data.s— Dot All: Makes the.metacharacter match newline characters (\n) in addition to all other characters. By default,.matches anything except line terminators.u— Unicode: Enables full Unicode matching. This flag is required to correctly match astral Unicode characters (emojis, CJK characters, etc.) using\u{...}escape sequences. It also treats the pattern and string as a sequence of Unicode code points rather than UTF-16 code units.y— Sticky: Forces the pattern to match only from the exact position indicated bylastIndex. Unlike the global flag, a sticky match will fail if the pattern does not match at the current position — it does not search ahead for later occurrences.
Common Regex Patterns
Here are several widely-used regex patterns you can load via the Quick Patterns dropdown or adapt into your own expressions:
| Purpose | Pattern | Description |
|---|---|---|
^[\w.-]+@[\w.-]+\.[a-z]{2,}$ | Validates email addresses with . and hyphen support in the local part and multi-letter TLDs. | |
| URL | https?://[^\s]+ | Matches HTTP and HTTPS URLs up to the next whitespace character. |
| Phone | (?:(?:\+|00)\d{1,3}[\s-]?)?(?:\\(?\d{2,4}\\)?[\s-]?){2,5}\d{4} | Flexible phone number matcher supporting country codes, area codes in parentheses, and various separators. |
| Date | \b\d{4}-\d{2}-\d{2}\b | Matches ISO 8601 dates in YYYY-MM-DD format. |
| IPv4 | \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b | Matches four-octet IPv4 addresses (basic validation, does not check octet ranges). |
| Hex Color | ^#?([a-f0-9]{6}|[a-f0-9]{3})$ | Matches 3-digit and 6-digit hex color codes with optional leading #. |
| Emoji | [\u{1F300}-\u{1FFFF}] | Matches emoji and pictographic Unicode characters (requires the u flag). |
Each of these patterns is available in the Quick Patterns dropdown for one-click testing. Try loading a pattern, then paste or type matching sample text into the test area to see instant highlighting.
Regex Quick Reference
.
Any character
\d
Digit
\w
Word char
\s
Whitespace
^
Start of line
$
End of line
*
0 or more
+
1 or more
?
0 or 1
()
Capture group
[]
Character class
|
Alternation
Related Tools
If you work with data transformation and validation, you may also find these ByteBox tools useful:
- JSON Formatter & Validator — Format, minify, and validate JSON data. Pair it with the regex tester to extract patterns from raw JSON before sending through the formatter.
- Text Diff Checker — Compare two blocks of text side by side. Use regex to isolate specific portions of a file, then diff the output to spot changes between versions.