Regex Tester — Test Regular Expressions Online
Regex Tester evaluates a regular expression pattern against input text and lists all matches with their start positions. Supports all JavaScript regex flags (g, i, m, s, u, y) and named capture groups.
Regular Expression Syntax Quick Reference
A regular expression is a pattern that describes a set of strings. The most fundamental building blocks: a literal character (a) matches itself; a dot (.) matches any character except newline; brackets ([abc]) match any one of the listed characters; a caret inside brackets ([^abc]) matches any character NOT listed. Quantifiers control repetition: ? means zero or one, + means one or more, * means zero or more, {n,m} means between n and m times.
Anchors constrain position rather than matching characters: ^ matches the start of a string (or line with the m flag), $ matches the end. \b matches a word boundary (the transition between \w and \W). Groups ((...)) capture matched substrings for extraction; non-capturing groups (?:...) group without capturing. Alternation (|) matches either the left or right pattern.
Named capture groups (?<name>...) are supported in modern JavaScript and are particularly useful for extracting structured data: the regex (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) extracts the year, month, and day of a date string into named properties of the match object, making the code self-documenting.
Flags and Modes
The g (global) flag finds all matches in the input rather than stopping at the first. Without g, only the first match is returned. The i flag makes the pattern case-insensitive. The m flag makes ^ and $ match at the start and end of each line, not just the entire string — essential for processing multi-line text. The s flag (dotAll) makes . match newlines as well as other characters.
The u flag enables full Unicode support: patterns like \p{Script=Greek} match all Greek Unicode characters, and surrogate pairs (emoji represented as two UTF-16 code units) are treated as a single character. Without u, a regex sees emoji as two separate characters and quantifiers may produce unexpected results.
Practical Examples
Email validation (simplified): /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/. This is intentionally simplified — fully RFC 5321-compliant email validation via regex is notoriously complex. For production use, send a confirmation email instead.
Extracting version numbers: /v?(\d+)\.(\d+)\.(\d+)/ matches "v1.2.3" and captures "1", "2", "3" as groups. With named groups: /v?(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/.
Finding all URLs in a block of text (basic): /https?:\/\/[^\s]+/g. Paste a block of log output or HTML source into the tester with this pattern and the g flag to extract every URL at once.
Common Use Cases
- Testing and debugging regex patterns for form validation
- Extracting data with regex from log files or API responses
- Learning regex syntax with immediate visual feedback
- Verifying that a regex matches all expected inputs
Frequently Asked Questions
What regex syntax does the SmartDevBox Regex Tester support?
SmartDevBox uses the JavaScript RegExp engine, which supports most standard regex syntax including lookahead, lookbehind (ES2018+), named capture groups, character classes, quantifiers, and all standard flags.
Privacy & Security
This tool runs entirely in your browser using client-side JavaScript. No data is sent to a server — your input never leaves your machine. SmartDevBox has no account system, no usage tracking, and no paid tier. See the Privacy & Security page for full details.
Related Tools
- Regex GeneratorGenerate a starter regex from sample text and get snippets for JavaScript, Python, Java, C#, C++, Go, Ruby, grep, and PHP. Free and client-side.
- JSONPath EvaluatorEvaluate JSONPath expressions against JSON input and view matching nodes. Free, no sign-up, 100% client-side.
- String InspectorView character, word, line, sentence, byte, and Unicode statistics for any text. Free, no sign-up, 100% client-side.
Related Recipes
- Find secrets in logsUse local extraction and inspection tools to catch common sensitive values before a log leaves your machine.
- Extract IPs from nginxTurn noisy access logs into a clean list of client IPs for incident triage, rate-limit analysis, or firewall review.