Regex Tester
Test regular expressions live. Matches highlighted inline, capture groups listed, replace mode built in. JavaScript engine.
About the Regex Tester
The DevKit4You Regex Tester is a live regular expression playground for testing, debugging, and validating JavaScript regular expressions directly in your browser. It provides instant match highlighting, capture group inspection, replace mode testing, and real-time regex execution using the native JavaScript regex engine.
Regular expressions (Regex) are powerful pattern-matching tools used across form validation, data extraction, search functionality, input sanitization, log parsing, URL matching, email validation, and text transformation. This tool helps developers quickly experiment with regex patterns before using them in production code.
Key Capabilities
(?<name>\w+)@(?<domain>\w+\.\w+)$1, $2, and $&.g (global), i (case-insensitive), m (multiline), s (dotall) to test different matching behaviours.Privacy & Transparency
The DevKit4You Regex Tester is built with privacy and transparency in mind.
How to Use
Using the DevKit4You Regex Tester is simple and fast.
-
01Enter a Regex PatternType your regex pattern into the pattern field between the
/delimiters.(hello|world)\s+\w+ -
02Add a Test StringEnter the text you want to test against in the Test String area.
Hello World, hello devkit4you 123 -
03View Live MatchesThe tool instantly highlights matches, shows matching sections, and displays capture groups as you type — no button needed.
-
04Inspect Capture GroupsReview extracted values from parentheses groups and named groups in the match results panel.
(\w+)@(\w+\.\w+) → $1 = username · $2 = domain.com -
05Test Replace ModeSwitch to Replace mode, enter a replacement string, and preview the output before using it in code.
Pattern: /hello/g · Replace: hi · Result: hi world -
06Test Split ModeSwitch to Split mode to see how your regex pattern divides the test string into an array of segments.
-
07Toggle Regex FlagsEnable or disable
g,i,m,sflags using the checkboxes next to the pattern field to test different matching behaviours.
Common Regex Examples
/^[^\s@]+@[^\s@]+\.[^\s@]+$/
/https?:\/\/[^\s]+/
/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/
/^\d{4}-\d{2}-\d{2}$/
/^(?:\d{1,3}\.){3}\d{1,3}$/
/[+]?[(]?[0-9]{1,4}[)]?[-\s.]?[0-9]{4,9}/
Understanding Regex Basics
A quick reference for the most common regex tokens and what they match.
| Token | Meaning | Example |
|---|---|---|
| \w | Word character — letters, digits, underscore | \w+ → "hello123" |
| \d | Digit — 0 through 9 | \d{4} → "2026" |
| \s | Whitespace — space, tab, newline | \s+ → " " |
| . | Any character except newline (use s flag to include newlines) |
h.t → "hat", "hit" |
| + | One or more of the preceding token | \d+ → "42", "007" |
| * | Zero or more of the preceding token | lo* → "l", "lo", "loo" |
| ? | Zero or one — makes the preceding token optional | colou?r → "color", "colour" |
| ( ) | Capture group — extract and reference with $1, $2… | (\w+)@(\w+) → $1, $2 |
| [ ] | Character class — match any one character inside | [aeiou] → "a", "e", "i" |
| ^ | Start of string (or line with m flag) |
^\d → first char is digit |
| $ | End of string (or line with m flag) |
\d$ → last char is digit |
| | | Alternation — match either left or right side | cat|dog → "cat" or "dog" |
| {n,m} | Quantifier — between n and m repetitions | \d{2,4} → "12", "1234" |
| \b | Word boundary — position between word and non-word | \bcat\b → "cat" not "catch" |