How do I match a literal dot in regex?
Escape it: \. matches a literal period. Inside [...] many specials are literal: [.*+] matches dot, star, or plus.
Test regular expressions with live match highlighting, groups, flags, and replace—runs locally, no upload.
Loading tool…
A regex tester runs a JavaScript regular expression against sample text and shows matches, capture groups, flags, and replace output—entirely in your browser with no upload.
A regular expression (regex) is a pattern language for searching, validating, and transforming text. Developers use regex in logs, APIs, form validation, and editors—but small syntax errors cause silent failures. A regex tester lets you paste a pattern and test string, toggle flags (global, multiline, case-insensitive), and see highlighted matches with group details before shipping code.
This tool uses the same JavaScript RegExp engine as Node.js and browsers, so results match runtime behavior for most web apps. It is not PCRE/Python syntax—possessive quantifiers and some escape rules differ. Patterns and sample text stay on your device; nothing is sent to EverydayTools servers.
Pair with JSON Validator when extracting fields from payloads, or Text Diff when comparing pattern output across versions.
Concise answers for common searches — definitions, steps, and comparisons.
Escape it: \. matches a literal period. Inside [...] many specials are literal: [.*+] matches dot, star, or plus.
Greedy * + ? {n,m} take as much as possible. Lazy *? +? ?? {n,m}? take as little—useful between delimiters like <tag>...</tag>.
Yes. All matching runs in your browser; patterns and test text are not uploaded to servers.
Patterns compile with new RegExp(pattern, flags) in an isolated Web Worker. Matches are collected with exec() in a loop when /g is set, with caps on match count and execution time to reduce ReDoS risk.
Formula
Match: RegExp.exec(testString) in loop
Replace: testString.replace(regex, replacement)Paste your RegExp pattern and sample text—or load Email, URL, or other presets from the library.
Enable global (g) for all matches, multiline (m) for line anchors, dotAll (s) so . matches newlines, and unicode (u) when needed.
Highlighted text shows each match; open match details for indices, numbered groups, and named groups.
Optional replacement string previews substituted output. Copy a share link with pattern and flags encoded in the URL.
Input
Pattern \d+ on text "Order 42 costs $19.99"Output
Matches 42 and 19, 99With /g the engine finds every digit sequence; without /g only 42 matches.
Input
Common email pattern vs alice+tag@sub.example.co.ukOutput
Match or no match with highlighted spanValidates practical format checks—not RFC-complete deliverability testing.
Common real-world scenarios where this tool saves time.
Load common patterns, then test edge cases (subdomains, plus addressing, ports) before form validation code.
Extract timestamps, IDs, or log levels from sample lines—locally, without uploading production logs.
Preview replace output with $1/$2 or named $<group> before running sed or editor batch replace.
Use the pattern explainer to see what each token means while building complex lookaheads and character classes.
Step-by-step chains that connect related tools for common tasks.
Test a practical email regex against a list of valid and invalid addresses.
Extract all URLs from a block of text using a regex.
Build a regex that matches common US and international phone number formats.
When to use each developer tool on EverydayTools.
| Tool | Best for |
|---|---|
| Regex Tester | Pattern match, groups, replace preview on arbitrary text |
| JSON Validator | Syntax-valid JSON before parsing or formatting |
| JSON Formatter | Beautify and minify JSON payloads |
| Text Diff | Compare two text or code versions line by line |
| Related tool | Use this tool when | Use related tool when |
|---|---|---|
| JSON Validator | You need to match, extract, or replace patterns in arbitrary text — log lines, CSV, HTML, or any string content. | You specifically need to validate whether a string is syntactically valid JSON before parsing it in your application. |
| Text Diff | You want to test a regex pattern against sample text and see which parts match. | You have two versions of a text and need to see exactly which lines changed — without needing a regex pattern. |
Use \. for a literal dot. Outside a character class these operators are metacharacters.
No possessive ++ or atomic groups; use JavaScript-compatible patterns or test in the target language.
Advertisement
JavaScript RegExp (ECMAScript) in your browser—the same engine as Node.js and front-end apps. PCRE/Python differ on possessive quantifiers, (?P<name>), and some escapes—re-test in your target runtime for production patterns.
With /g the engine finds every match and advances through the string. Without /g only the first match is returned—replace also affects only the first occurrence unless /g is set.
g = all matches; i = case-insensitive; m = ^ and $ per line; s = dot matches newlines; u = Unicode; d = match indices; v = unicode sets; y = sticky. Combine flags: /pattern/gim.
Enter pattern and test text—matches highlight as you type. Turn on /g for all occurrences. Add a replacement to preview substituted text. Syntax errors show immediately with a clear message.
Nested quantifiers like (a+)+ can make the engine try exponentially many paths on non-matching input, freezing the tab. Avoid nested quantifiers on the same class; test long non-matching strings; this tool times out long runs in a worker.
.+ matches one or more of any character (except newline by default). .* matches zero or more — it can match an empty string. Both are greedy by default. Use .+ when at least one character is required. Add ? to make them lazy: .+? and .*? match as few characters as possible. The s flag makes . match newlines too.
A practical JavaScript email regex: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/. Enter it as the pattern and test against valid/invalid addresses. Note: no regex fully validates email per RFC 5322 — use it for basic format checks only. For authoritative validation, send a confirmation email.
A capture group is a parenthesized subpattern that saves the matched text for later use. In /([0-9]+)-([a-z]+)/, group 1 captures the digits and group 2 captures the letters. You can reference captured groups in replacement strings ($1, $2 in JavaScript) or read them from the exec() result array. Named capture groups use (?<name>pattern) syntax: /(?<year>[0-9]{4})-(?<month>[0-9]{2})/.
Adding ? after a quantifier makes it non-greedy (lazy): it matches as few characters as possible. Example: /<.+?>/ on '<b>bold</b>' matches '<b>' and '</b>' separately. Without the ?, /<.+>/ would greedily match the entire '<b>bold</b>' string as a single match. Use lazy quantifiers when matching between delimiters.
Lookahead (?=pattern) asserts that what follows the current position matches pattern without consuming characters. Example: /\d+(?= dollars)/ matches digits followed by ' dollars' but doesn't include ' dollars' in the match. Negative lookahead: (?!pattern). Lookbehind (?<=pattern) asserts what precedes. Example: /(?<=\$)\d+/ matches digits after a dollar sign. JavaScript supports lookbehind since ES2018.
Yes. 'hello world'.replace(/o/g, '0') → 'hell0 w0rld'. Without /g only the first match is replaced. In replacements, $& is the full match, $1 $2 are capture groups, $` is the text before the match, $' is the text after. You can also use a function as the replacement argument for dynamic substitutions: str.replace(/\d+/, n => n * 2).
\w is the word character shorthand and is equivalent to [a-zA-Z0-9_] in ASCII mode. With the u flag (Unicode mode) in JavaScript, \w still matches only ASCII word characters — not Unicode letters. To match Unicode letters, use \p{Letter} or \p{L} with the u or v flag: /\p{L}+/u. [a-zA-Z0-9_] is explicitly ASCII only regardless of flags.
Use the m flag to make ^ match the start of each line and $ match the end. Without /m, ^ and $ anchor to the start/end of the entire string. The s (dotAll) flag makes . match newlines, enabling patterns like /<div>[\s\S]*?<\/div>/s or /<div>.*?<\/div>/s to span lines.
^ asserts the start of the string (or start of line with /m flag). $ asserts the end of the string (or end of line with /m). Pattern /^hello/ only matches strings that begin with 'hello'. /world$/ matches strings ending with 'world'. /^hello world$/ matches the exact string 'hello world'. Without anchors, a pattern matches anywhere in the string.
A practical US phone regex: /^\+?1?[\s.-]?\(?([0-9]{3})\)?[\s.-]?([0-9]{3})[\s.-]?([0-9]{4})$/. Test variants like (555) 123-4567, 555-123-4567, and +1 555 123 4567. For international numbers, use libphonenumber (Google's library) rather than regex — international formats vary too widely for a single pattern.
Patterns and test strings are evaluated in a browser Web Worker. Nothing is uploaded to EverydayTools—safe for logs containing tokens or personal data.
Uses the native JavaScript RegExp engine—the same semantics as Node.js and modern browsers for the flags you select.
For debugging and learning patterns—not a substitute for security review or production ReDoS audits on user-supplied regex.
Part of Developer Tools
More free tools for the same workflow.
Advertisement
Reviewed by EverydayTools Editorial Team on 2026-05-20.
Live highlights
See matches highlighted in the test string as you edit pattern and flags.
Replace preview
Step through matches and preview replace-all output before copying.
Runs locally
RegExp runs in a Web Worker—patterns and text never leave your browser.
Regex checker & validator — uses the same JavaScript RegExp engine as Node and browsers. Patterns and test text never leave your device.
Engine
JavaScript RegExp—same as Node.js and browsers
Global /g
Find all matches; required for replace-all
Privacy
Worker runs locally—patterns never uploaded
/pattern/g$& = full match, $1 $2 = capture groups. Runs entirely in your browser.
Enter a pattern to see token explanations.
No saved regexes. Saves stay in your browser (localStorage).
See matches update instantly as you type.
Runs 100% locally — no data leaves your browser.
Enter a regex pattern above to see matches here.