Developer & API

Regex Tester & Builder Online

Live match highlighting, capture groups and flags.

//g

2 matches

Contact ada@veojson.com or grace@example.org for access requests.

  • #1 @ 8 — ada@veojson.comgroups: [ada, veojson.com]
  • #2 @ 27 — grace@example.orggroups: [grace, example.org]

RegEx Cheat Sheet — 50 Patterns That Actually Ship

50 copy-paste patterns, the full syntax table, flag reference and the traps that cause outages.

One email, no spam, unsubscribe any time.

Common patterns

Copy-ready patterns, each tested against the sample shown. Load one into the tester to try your own text.

Email

/[\w.+-]+@[\w-]+\.[\w.-]+/g

Sample: Write to ada@veojson.com or grace.h+ops@example.co.uk · 2 matches

URL

/https?:\/\/[^\s/$.?#].[^\s]*/gi

Sample: Docs at https://veojson.com/tools and http://example.org/a?b=1 · 2 matches

IPv4

/\b(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)\b/g

Sample: Hosts 10.0.0.1, 192.168.1.254 and invalid 999.1.1.1 · 2 matches

ISO date

/\b\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])\b/g

Sample: Released 2026-10-19, patched 2026-11-02, not 2026-13-40 · 2 matches

UUID

/\b[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\b/gi

Sample: id=550e8400-e29b-41d4-a716-446655440000 ref=not-a-uuid · 1 matches

Hex colour

/#(?:[0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{3,4})\b/gi

Sample: Brand #22c55e, overlay #00000080, short #fff · 3 matches

About this tool

This tester runs your pattern with the JavaScript RegExp engine, highlights every match in the sample text, and lists capture groups per match. Flags for global, case-insensitive, multiline, dotAll and unicode matching can be toggled independently.

How to test a regular expression

Enter the pattern without slashes, choose your flags, then paste sample text. Matches are highlighted immediately and each match is listed with its index and capture groups so you can confirm the groups line up with your code.

Common regex mistakes

Forgetting to escape dots and slashes, using greedy quantifiers where lazy ones are needed, and assuming ^ and $ match line boundaries without the multiline flag are the three that bite most often.

How to use Regex Tester & Builder

  1. 1

    Type a pattern

    Enter a regular expression such as (\w+)@(\w+\.\w+) in the pattern field.

  2. 2

    Toggle the flags

    Switch g, i, m, s and u on or off to match the behaviour your code will use.

  3. 3

    Paste test text

    Add the text you want to match against; matches highlight live as you type.

  4. 4

    Read the groups and copy

    Inspect the capture groups for each match, then copy the result as /pattern/flags.

Best practices

  • Anchor patterns with ^ and $ when validating whole values, or you will match a substring and let bad input through.
  • Prefer explicit character classes over `.` — greedy dots are the root of most catastrophic backtracking.
  • Test with adversarial input: empty strings, very long strings and Unicode, not just the happy path.
  • Name your groups and add comments; a regex you cannot read in six months is a liability.
  • Never use regex to parse HTML, JSON or email addresses at full RFC fidelity — use a real parser.

Regex Tester & Builder — Why it matters

Small integration details — an encoding, a claim, a header — are where most API bugs actually live, and they are expensive to find in production logs.

Getting them right in seconds keeps debugging sessions short and prevents malformed data from reaching downstream systems.

Related free & paid tools

Tool nameTypeKey featuresLink
regex101FreeMulti-flavour tester with step-by-step explanationVisit
RegExrFreeInteractive cheatsheet and community patternsVisit
RegexBuddyOfferPaidDesktop regex builder, debugger and code generatorVisit

Some links marked Offer are partner links. They cost you nothing extra and help keep these tools free.

Related tools

Frequently asked questions