What this RegExp test proves—and what it deliberately does not prove
Regular expressions are tiny programs over text: the same pattern string plus the same flags must behave like the new RegExp constructor in a modern browser because this page evaluates matches with the ECMAScript engine, not PCRE, Python, Ruby, or Java—if your logs or services use another dialect, treat anything you copy from here as a first draft and re-test in that runtime.
The UI separates pattern from flags so you are not fooled by slash confusion: writers often paste a full /pattern/gi literal into a field that expects only the middle part and then wonder why the global flag vanished; here the literal is only the pattern body and each flag has an explicit toggle. When you are comparing two dump files line by line, patterns and samples still land in different buffers—use side-by-side text compare there and reserve this page for “does this extractor grab the substring I think it grabs?”.
Matches return zero-based start–end indices and optional capturing groups so you can wire the same mental model as String.match, RegExp.exec, and matchAll in application code; they do not run your replacement strategy or split pipeline—after you trust the pattern, move the verified substring rules into your bundler, API layer, or editor macro, optionally pasting through JavaScript formatter when the pattern is embedded in source.
Engine rules, flag semantics, and capture numbering that follow ECMAScript
How the full match, numbered captures, and optional named groups relate to group 0 and RegExp.exec
- Group 0 is always the entire substring that satisfied the pattern for that match attempt; numbered groups 1…n appear in left-to-open-paren order, which matters when you nest alternation.
- Named groups (?<id>…) show up with their names only when the pattern is valid under the chosen flags; duplicate names in one pattern are a syntax error, unlike some PCRE-only conveniences.
- The index span is half-open in spirit for humans here: the UI prints start–end where end is the last inclusive character index of the match so you can eyeball overlap; copy the values into code that expects exclusive end positions by adding one when needed.
What flags g, i, m, s, u, and y change for line breaks, dot behaviour, and Unicode
- g finds every non-overlapping match and keeps lastIndex advancing in the real RegExp object—without it you only observe the first match, which is how validation patterns differ from extraction patterns.
- m makes the caret and dollar anchors refer to line boundaries inside a multiline paste; without it a whole syslog buffer can look like “one line” to the anchors.
- s (dotAll) lets the dot cross newline boundaries; combined with m you can express “block inside a stanza” without awkward negated-class gymnastics.
- u turns on Unicode-aware parsing for identifiers, \p{…} property escapes where supported, and sane handling of astral characters; y pins the next match attempt to the current lastIndex, which models sticky tokenisers.
Why greedy versus lazy quantifiers change runtime cost and stack depth
- By default star and plus quantifiers consume as much as possible and backtrack only when a later part of the pattern fails; that is fast when the tail is discriminating and catastrophic when it is not.
- Appending a question mark to a quantifier makes it lazy (take the smallest stretch that still allows the rest to succeed), which can reduce accidental huge grabs in log lines but can increase backtracking on pathological strings.
- When a pattern “hangs” on multi-megabyte paste, simplify anchors, narrow character classes, or pre-split the file—regex is rarely the right tool for whole-file scanning without chunking.
Literal escapes, surrogate pairs, and why pasted code differs from pasted prose
- A backslash in the pattern field is one keyboard backslash; when you lift a pattern from C++ or Java source you may need to halve the escapes compared to what the string literal contained.
- Emoji and rare scripts may use surrogate pairs in UTF-16; the u flag affects whether those code points are treated as single characters for dot and {n} counts.
- If you need to see the exact bytes your CMS will store, cross-check lengths with text statistics after extraction.
Where quick browser-side RegExp tests save review time
Pulling structured fields without standing up a JSON parser
A one-line API response in a ticket is often enough to sanity-check a pattern that pulls the orderId value from JSON-shaped text before you paste the same expression into a monitoring alert; confirm group 1 is the identifier you expect, then harden with real parsing in code.
Reconstructing HTTP client IP and status from nginx-style access lines
When a dotted IPv4 run plus a lazy span and a three-digit HTTP status fit your log vendor’s quoting, group 1 is the IPv4-looking token and group 2 is the status code—if the format wraps quoted fields differently, tighten the middle non-greedy span before shipping a dashboard filter.
Sanity-checking hrefs and opaque IDs before regex lands in a sanitizer
Patterns that read URL tokens from href attributes or use UUID-shaped character classes find candidates in HTML fragments; they are not a security boundary—pair the extraction preview here with your CSP, allow-lists, and DOM parsing rules.
Verifying CSV-ish or log lines before a migration script runs once
When columns moved between exports, a staged pattern on a sample row catches delimiter shifts early; for whole-file semantic comparison of settings, prefer structured diff tooling after you normalize with JSON formatter on both sides.
Common questions
How do I test a regular expression online for JavaScript before I paste it into my app?
Do I type the slash characters around the pattern body in the pattern field?
Why does my Python or Java regex work but this page says invalid or matches nothing?
What does group 0 mean in the match list?
Why am I seeing unexpected matches or no matches on this page?
Can I test search-and-replace or String.replace strategies here?
How do I debug catastrophic backtracking or “pattern takes forever” on a long paste?
Should I validate email, URLs, or phone numbers with only a regex?
Patterns to paste into the pattern field
[\w.+-]+@[\w.-]+\.\w+Mailbox-shaped token for mixed-case prose — try flags gi when normalising marketing copyhttps?://[^\s"'<>]+http/https URL candidates in logs or chat — flag g enumerates every non-whitespace run[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}UUID-shaped tokens in traces — still verify version and entropy in business logic\d{4}-\d{2}-\d{2}ISO-like dates yyyy-MM-dd in filenames or reports\b(?:\d{1,3}\.){3}\d{1,3}\bIPv4-shaped quads — not strict 0–255 validation[?&]id=([^&]+)First id= query parameter — group 1 is the captured value