GenerateRandomSearch

Regex Pattern Sample Generator

Shows a common validation regular expression alongside a real example string it matches — a quick reference for testing a pattern or learning regex syntax without writing one from scratch.

What you'll get

This generator draws from a hand-checked list of 18 entries. Here is a spread of 6 of them, so you can see the style before you generate:

  • ^[\w.+-]+@[\w-]+\.[a-zA-Z]{2,}$ — matches: name.tag+sort@example.co.uk
  • ^https?:\/\/[\w.-]+(\/[\w./?%&=-]*)?$ — matches: https://example.com/path?x=1
  • ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$ — matches: Passw0rd123
  • ^\d{1,3}(\.\d{1,3}){3}$ — matches: 192.168.1.10
  • ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ — matches: 550e8400-e29b-41d4-a716-446655440000
  • ^(0|[1-9]\d*)$ — matches: 0 or 42, not 007

A fixed sample of the list, not a live draw — your own results are picked at random from all 18, without repeating until the list runs out. Original authoring for Generate Random — common validation patterns, not copied from any single library.. Last reviewed 2026-07-18.

How to use this tool

  1. Press generate for a pattern.
  2. Generate again for a different one.

Common use cases

  • Learning regex syntax by example
  • Quick validation-pattern reference
  • Testing a regex engine's behaviour

Practical tips

  • Test any pattern against strings that should fail as well as ones that should pass; a pattern matching everything looks correct until it does.
  • Watch for catastrophic backtracking in patterns with nested quantifiers — the sample may be fine and your input may not be.

Entries are chosen with your browser's cryptographic random number generator, so every entry on the list is equally likely. How Generate Random works.