JSON to Query String
Serialise a JSON object into a percent-encoded URL query string.
Every regex token, searchable, with an example of what it matches.
A searchable regular expression reference where every token comes with a worked example — because knowing that \b exists tells you nothing about what it matches.
A complete reference for regular expression syntax, searchable by the token itself or by what you are trying to do. Every entry has an example, because the syntax is only half the problem — knowing that \b exists does not tell you what it matches.
It covers character classes, quantifiers and their lazy forms, anchors, groups both capturing and not, lookahead and lookbehind in all four directions, backreferences, Unicode property escapes and every flag. The distinctions that cause the most confusion are called out: greedy against lazy, the dot not matching a newline by default, and why a dot inside a character class is just a dot. A set of ready-made patterns for email, URLs, dates and postcodes comes with it.
A pattern, what it matches and — just as usefully — what it does not.
Type "start of line" or "optional" rather than having to already know the symbol.
Greedy against lazy, the dot not matching newlines, and why a dot inside a character class is just a dot.
Positive and negative, ahead and behind, with an example of each and a note on where lookbehind is unsupported.
Email, URL, date, postcode and more — each with the caveat that goes with it, since none of them is truly complete.
Type the syntax, or describe what you want to match.
Each entry shows a pattern and what it does and does not match.
Classes, quantifiers, anchors, groups, lookaround or flags.
Common patterns for email, URLs, dates and more, with their caveats.
A greedy quantifier takes as much as it can and gives back only when forced; a lazy one, written with a trailing ?, takes as little as possible. On <.+> against two tags, greedy matches both and lazy matches the first.
Because it never does by default — that is the one exception to "any character". The s flag, sometimes called dotall, changes it.
A position, not a character: the boundary between a word character and a non-word one. That is why \bcat\b matches cat in "the cat sat" but not in "concatenate".
Not reliably. HTML nests arbitrarily and regular expressions cannot count, so any pattern breaks on a case you did not anticipate. Use a parser — the HTML to Markdown and formatter tools here both do.
What people who use the Regex Cheatsheet think of it. Reviews come from visitors and are posted as written.
No ratings yet
Yours would be the first.
0 reviews
Newest first
No reviews yet
Be the first to rate the Regex Cheatsheet. It takes half a minute and no account.
Write the first reviewSerialise a JSON object into a percent-encoded URL query string.
Convert text to Base64 and back, with full Unicode support.
Build media queries with framework breakpoints and modern features.
Generate plausible addresses in the format each country actually uses.
Convert a duration between seconds, ISO 8601, clock time and words.
Compile SCSS to plain CSS in your browser — nesting, variables and mixins.
Draw a grid layout and get the CSS, including named template areas.
Encode and decode Base58 in the Bitcoin, Ripple or Flickr alphabets.