Example
Pattern + test input
Pattern: \b[\w.+-]+@[\w-]+\.[\w.-]+\b Flags: g Test: Contact hello@yutils.dev or sales+korea@yutils.dev for inquiries.
Match result
2 matches - hello@yutils.dev (pos 8, len 16) - sales+korea@yutils.dev (pos 28, len 22)
Note
Without the g flag only the first match is shown. Capture groups also appear as $1, $2 indexed sub-results.
Usage / FAQ
When to use
- Validate email / URL / phone number extraction patterns
- Test JavaScript RegExp behavior exactly (no engine differences)
- Inspect capture groups — $1, $2 ... indexed in results
- Toggle g flag for all matches, i for case-insensitive
- Debug regex by spotting match position and length
FAQ
- Q.Is this compatible with Python / Java / PHP regex?
- A.Engines differ. This tool uses JavaScript RegExp — lookbehind, named groups behave differently across languages. For cross-language compatibility, check a PCRE-compatible tool separately.
- Q.My pattern hangs (catastrophic backtracking)
- A.Nested repetition like `(a+)+` or wide alternation triggers backtracking explosion. JS lacks atomic groups — redesign or use possessive quantifiers where supported.
- Q.Capture vs non-capturing group?
- A.Use `(?:...)` for grouping without capture. Avoid `(...)` when you don't need the match — saves memory and slight perf.
Fun facts
The mathematical foundation of regular expressions comes from Stephen Kleene in 1956. The asterisk in `a*` (Kleene star) is literally named after him — "a repeated zero or more times". This was decades before "regex" became a thing, and before computers were widely available.
Wikipedia — Stephen KleeneJamie Zawinski's famous quote: "Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems." It was a joke from 1997, but Stack Overflow and Twitter still quote it weekly.
Wikipedia — ZawinskiRegex engines are not a single thing — POSIX BRE, POSIX ERE, PCRE, Perl, Python `re`, JavaScript RegExp, and more. Support for lookbehind, named groups, atomic groups, etc. differs across engines. This tool uses JavaScript RegExp, so results may diverge from Python regex on edge cases.
Wikipedia — Regex standards
Related guides
- Regex Tutorial — From Basics to Lookarounds and Catastrophic Backtracking
Hands-on regex tutorial covering character classes, quantifiers, groups, lookaround, and the catastrophic backtracking patterns to avoid.
- Why Regex Sometimes Hangs (ReDoS Explained)
Regex engines that backtrack can take exponential time on innocent-looking patterns like (a+)+. Learn the NFA/backtracking model, the ReDoS attack vector, and the linear-time engines (RE2) that prevent it.
Related tools
- JSON Formatter / Validator
Format, validate, and minify JSON strings. Adjust indent and optionally sort keys. Runs entirely in your browser.
- String Case Converter
Convert strings between camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, and Title Case — all six cases shown side-by-side.
- Markdown Preview
Render Markdown to HTML side-by-side. Supports CommonMark + GFM (tables, fenced code, task lists). marked is lazy-loaded.
- HTML → Markdown
Convert HTML into Markdown. Headings, lists, links, code, tables, blockquotes. Uses the browser's DOMParser — accurate, 0 dependency.
- YAML ↔ JSON
Convert between YAML and JSON. Tolerates comments and multiline strings on the YAML side. yaml is lazy-loaded.
- Text Diff
Compare two texts and highlight added/removed lines, words, or characters.
- JSON Diff
Compare two JSON values, with optional key sorting and JSON-aware error messages.
- CSV ↔ JSON
Convert between CSV and JSON. Handles quoted fields, custom delimiters, and header rows.
- SQL Formatter
Format SQL queries with proper indentation and keyword casing. Supports PostgreSQL, MySQL, SQLite, and standard dialects.
- XML Formatter
Pretty-print or minify XML with attribute preservation. Handles SOAP, sitemaps, and config files.
- XML ↔ JSON
Convert between XML and JSON with attribute and element handling.
- Smart Paste
Paste any text and get tool recommendations — JSON, JWT, Base64, URL, UUID, Cron, and 9 more types auto-detected.
- Lorem Ipsum
Generate placeholder text in words, sentences, or paragraphs. Classic Lorem Ipsum or randomized.
- JSON Path
Query JSON with JSONPath expressions ($.store.book[*].author etc.) and inspect matches.
- JSON Schema Validator
Validate JSON data against a JSON Schema (Draft 2020-12). Powered by Ajv with format support.
- JSON Schema Generator
Generate a JSON Schema (Draft 2020-12) from a sample JSON. Infer types, required fields, and nested structures automatically.
- HTML Formatter
Beautify or minify HTML with proper indentation, attribute alignment, and configurable wrap.
- CSS Formatter
Beautify or minify CSS with proper indentation. Configurable selector and property style.
- JavaScript Formatter
Beautify or minify JavaScript with brace style and indent options. Powered by js-beautify.
- TOML ↔ JSON
Convert between TOML (Tom's Obvious Minimal Language) and JSON. Used in Cargo.toml, pyproject.toml, etc.
- INI ↔ JSON
Convert INI configuration to JSON and back. Supports sections, comments (; or #), and key=value.
- JSON → TypeScript
Generate TypeScript interfaces from a JSON sample. Nested objects become separate interfaces.
- JS Object → JSON
Convert a JavaScript object literal (unquoted keys, single quotes, trailing commas, comments) into standard JSON. Lenient parser, strict output.
- Slug Generator
Convert text into a URL-safe slug. Configurable separator, lowercase, and accent stripping.
- ASCII Tree
Convert indented text or path list into a box-drawing tree (├── │ └──).
- Diff Patch
Generate a unified diff (-u) patch from two text inputs. Compatible with `git apply` / `patch -p0`.
- Mock Data
Generate fake JSON records and SQL INSERT seed data — names, emails, custom fields, UUIDs, dates, and more. 0 dependency.
- MongoDB Extended JSON
Convert MongoDB Extended JSON (EJSON) between Canonical and Relaxed forms, or strip BSON wrappers to plain JSON. Recognizes 16 wrapper types ($oid/$date/$numberLong/$numberDecimal/$binary/...).
- Kubernetes YAML Visualizer
Paste Kubernetes manifests and see the resource graph — Deployments, Services, Ingresses, ConfigMaps, Secrets, PVCs, and how they connect. yaml is lazy-loaded.
- Docker Compose Visualizer
Paste docker-compose.yml and see services, networks, volumes, and depends_on as an interactive graph. Client-side, lazy-loaded yaml.
- PDF Text Extractor
Extract text from a PDF file — page by page or as a single document. Markdown-friendly output, all client-side.
- PPTX Text Extractor
Extract slide text from a .pptx file — plain / markdown / per-slide. Great for converting decks to markdown. All client-side.
- Regex Railroad Diagram
Visualize your regex as a railroad diagram — trace branches, groups, and quantifiers at a glance, in your browser.
- Word & Character Counter
Count characters (with/without spaces), words, sentences, paragraphs, lines, and bytes in real time — free, in your browser.