JavaScript Regex Cheatsheet - Online Interactive Pattern Reference
Interactive cheatsheet for JavaScript regular expressions with live examples. Click any token to see its explanation and test it on sample text immediately.
UD5 Toolkit
Detect, benchmark & analyze regex patterns for catastrophic backtracking risks with timeout protection.
(a+)+b matched against aaaaaaaaaaaaaaac, where the engine exhaustively tries every possible grouping of "a"s before finally failing on the "c".
(a+)+, (a*)*, (.+)+(a|aa)+ where one alternative is a prefix of another.*.*=.* or .+.*([a-z]+)*++, *+, ?+) where supported, which prevent backtracking into quantified subexpressions.(?>...) to prevent the engine from revisiting matched content.(a|aa)+ to a+.+?, *?) when greedy matching isn't required.++, *+, ?+, {n,m}+) match as much as possible and never give back matched characters during backtracking. They are supported in Java, PHP PCRE, Perl, and Ruby, but not in JavaScript.(?>...) work similarly—once the group matches, the engine won't revisit it to try alternative paths. Also not natively supported in JavaScript, though some libraries emulate them.(a+)+b on "aaaaac" might take microseconds, but on "aaaaaaaaaaaaaaaac" it could take seconds or minutes. The benchmark feature in this tool helps you visualize this by testing multiple string lengths and showing how execution time scales.
RegExp does not guarantee linear-time matching. This means poorly crafted patterns can cause significant performance issues in Node.js servers, browser-based applications, and anywhere JavaScript runs. Always test your regex patterns with tools like this one before deploying them in production.
Interactive cheatsheet for JavaScript regular expressions with live examples. Click any token to see its explanation and test it on sample text immediately.
Enter a simple regular expression and see its equivalent Deterministic Finite Automaton diagram. Learn how regex engines work.
Test a regular expression against malicious inputs to detect catastrophic backtracking and ReDoS vulnerabilities. Educational.
Render 1000 styled elements using inline styles vs. CSS classes and compare time. Understand CSS‑in‑JS trade‑offs.
Toggle content‑visibility: auto on long blocks and see the rendering time difference. Understand this powerful property.
Construct HTTP Link headers for server push replacements, preload, and preconnect. Copy the header value.
Practice positive/negative lookahead and lookbehind. See matches highlighted live. Master advanced regex.
Test regular expressions with Unicode property escapes like \p{Emoji}. See matches live. Modern regex power.
Calculate large Fibonacci numbers in a Web Worker. See the UI remain responsive. Copy the pattern for your app.
See your current page load broken down into DNS, TLS, request, and DOM phases. Understand where time is spent.
Adjust page characteristics (image size, server delay, layout shift) and see the simulated Core Web Vitals scores. Understand what impacts performance.
Enter a URL and see a waterfall of external scripts with their download size and execution time estimate. Identify performance culprits.
Paste your full CSS and HTML; automatically identify and extract the styles needed for the visible part. Reduce render‑blocking resources.
Start recording and watch for Long Tasks that block the main thread. See task duration and attribution. Improve Interaction to Next Paint.
Measure your browser's GPU compute power using a simple WebGPU matrix multiplication. See raw FLOPS and compare with peers. Fully client‑side.
Paste a raster image and an SVG, see the file size and rendering time. Understand when to use vector. Local.
Count total DOM nodes on the current page and show warnings if limits exceed best practices. Keep the DOM lean.
Add many complex CSS styles and measure frames per second. Isolate expensive properties. Practical performance lab.
Apply content‑visibility: auto to off‑screen sections and see the rendering cost drop. Demos for infinite scroll optimization.
Toggle contain: strict, content, paint, layout and see how it affects rendering. Understand isolation for faster pages.
Apply will‑change to any element and see its effect on compositing. Learn best practices for smooth animations.
An interactive reference for regular expression tokens. Click a token to see its explanation and example. Learn regex faster.
Enter a URL and get a one‑page report of titles, description, headings, image alts, and broken links. All from browser.
Paste a regular expression and get a step‑by‑step plain English explanation of what it does. Learn regex.
Enter a regular expression and see a visual railroad diagram explaining the pattern. Learn and debug regex.
Enter a URL and get a rough client-side performance simulation: request count, DOM size, and potential speed tips. No real Lighthouse.
Pull out all URLs and links from text. Extract domains, paths, and protocols. Perfect for SEO scraping or analyzing text documents. Client-side execution.
Extract all email addresses from a text block using a regex pattern. Deduplicate and sort results. Handy for lead extraction. Data stays on your machine.
Perform simple or regex-based find and replace operations on text. Batch replace words, phrases, or patterns instantly. Processed locally in your browser.
Build and test regular expressions against sample text. Real-time match highlighting, capture groups display, and flavor options. All inside your browser.