Regex Reference
Search JavaScript regex syntax and try runnable examples with matching flags. Reference for character classes, groups, quantifiers, lookarounds and Unicode.
Use Search the reference to find a token or concept. Copy an example pattern or choose Try in tester to open its pattern, flags and sample text in the same language.
Last updated:
Regex Cheat Sheet — Free Regular Expression Quick Reference. Search JavaScript regex syntax and try runnable examples with matching flags. Reference for character classes, groups, quantifiers, lookarounds and Unicode.
Our free regex cheat sheet is a single-page quick reference for JavaScript regular expression syntax. Search sections, copy examples and open them in the tester. The site displays ads. Find the tokens you need.
What's Covered Character classes : \d , \w , \s , [a-z] , negations Quantifiers : * , + , ?
, {n,m} Anchors : ^ , $ , \b Lookaheads & lookbehinds : (?=...) , (?!...) , (?<=...) , (?<!...) Groups & captures : (foo) , (?:foo) , backreferences Alternation : foo|bar Flags : g , i , m , s , u , y , d , v How to Use a Regex Cheat Sheet Scan the section that matches what you're trying to build — validation, extraction, or replacement.
Find the token, copy the syntax, test it in our Regex Tester . Done. JavaScript-Specific Notes This cheat sheet focuses on JavaScript's RegExp . Flags, Unicode handling and advanced syntax differ across engines and browser versions.
Always test in your target runtime.
Frequently asked questions
How do I use this regex cheat sheet?
Search by token or concept to filter whole reference sections and runnable examples. Copy pattern copies only the pattern; Try in tester opens the example with matching flags and built-in sample text.
Which regex flavor does the cheat sheet cover?
It follows JavaScript regular expression syntax, as used by RegExp in browsers and Node.js. Most tokens, such as \d, \w, character sets and quantifiers, work the same in PCRE, Python and Java, but lookbehind support and some escapes differ between engines.
Which characters need to be escaped in a regex?
Escaping rules depend on context and Unicode mode. For arbitrary literal text, use RegExp.escape() where supported instead of a hand-written escaping routine. In v-mode character classes, additional reserved punctuation and set syntax apply; consult the JavaScript reference.
What is the difference between a capturing and a non-capturing group?
A capturing group such as (foo) matches and remembers the text, so you can reuse it with a backreference like \1 or read it from the match results. A non-capturing group, (?:foo), only groups the pattern without storing what it matched.
What do lookahead and lookbehind do?
Lookarounds check the text next to a match without including it in the result. foo(?=bar) matches foo only when bar follows it, and foo(?!bar) only when bar does not follow. Lookbehinds do the same for text before the match, such as foo only when preceded by bar.
What does \b mean in a regex?
\b is a word boundary: a zero-width position between a word character (letter, digit or underscore) and a non-word character, or at the start or end of the string next to a word character. For example, \bcat\b matches cat on its own but not inside concatenate.
How to use this online tool
Regex Cheat Sheet — Free Regular Expression Quick Reference is designed for fast browser workflows when you need to format, validate, convert, decode, encode, generate, or inspect data without opening a heavy desktop app. Start with the input field or visible options, review the result, then copy or download the output for the next step.
Private processing in your browser
Regex Cheat Sheet — Free Regular Expression Quick Reference keeps the normal processing step local in your browser. That is useful for code snippets, tokens, documents, configuration values, text samples, and other material that should not be sent to a remote service unless you explicitly choose to share it.
When this tool is useful
Use Regex Cheat Sheet — Free Regular Expression Quick Reference for repeatable developer tasks, technical documentation, QA checks, quick conversions, debugging, content cleanup, and internal team workflows. The page focuses on clear inputs, immediate feedback, and output that is easy to reuse in code, reports, tickets, emails, or notes.
Practical tips
Before copying the final result, check important details such as spacing, casing, filenames, encoding, token structure, line breaks, or output format. Small checks prevent mistakes when the result is reused in source code, API requests, documentation, spreadsheets, or shared files.