Features
Sharing & URLs

Sharing & URLs

RegexLens makes it easy to share exact editor state via URL query parameters. For templates and fixture suites, use the header menus—see Fixtures & Templates.

Shareable Links

Every regex state in RegexLens can be shared via URL. The main Next.js app uses the nuqs helper to read and write p, f, and t on /app. Values are base64-encoded (UTF-8 → base64, then URI-friendly use in query strings) so arbitrary Unicode in patterns/text round-trips. The pattern, flags, and test text are encoded in the URL parameters.

How to Share

  1. Click the Share button in the header
  2. Click Copy Link to copy the URL to your clipboard
  3. Share the link with teammates, in documentation, or in code reviews

URL Structure

https://regexlens.dev/app?p=BASE64_PATTERN&f=FLAGS&t=BASE64_TEXT
ParameterDescription
pBase64-encoded regex pattern
fFlags string (e.g., "gi")
tBase64-encoded test text

Benefits

  • No login required — Anyone can view shared patterns
  • No data stored — Everything is in the URL
  • Permanent links — Links never expire
  • Full state — Pattern, flags, and test text are all preserved

Use Cases

  • Code reviews — Share a regex with your PR for explanation
  • Documentation — Link to interactive examples
  • Bug reports — Show exactly what you're testing
  • Teaching — Share patterns with students or teammates

Built-in Templates

RegexLens includes 15 real-world regex patterns to learn from. Access them via the Examples dropdown in the header.

Available Templates

TemplateDescriptionPattern
A/B + digitsMatch sequences like AB12, AAA99^[A-Z]+\d{2,4}$
Email (basic)Simple email validation^[\w.-]+@[\w.-]+\.\w{2,}$
US PhoneFlexible phone number formats\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}
ISO DateYYYY-MM-DD validation^\d{4}-\d{2}-\d{2}$
Quoted stringsExtract strings with escapes`"(?:[^"\]
URL (HTTP/S)Match web URLshttps?://[\w.-]+(?:/[\w./-]*)?
TODO commentsFind TODO in code//\s*TODO:?\s*(.*)
Multiple spacesDetect extra whitespace\s{2,}
Markdown headingsParse # headings^(#{1,6})\s+(.+)$
Word boundariesCapture whole words\b\w+\b
Password policyComplexity requirements^(?=.*[A-Z])(?=.*[a-z])(?=.*\d).{8,}$
Named groupsPhone with named captures(?<area>\d{3})-(?<exchange>\d{3})-(?<subscriber>\d{4})
Key=value pairsConfig file parsing^(\w+)=(.*)$
HTML tagsSimple tag matching<(\w+)[^>]*>.*?</\1>
Danger demoCatastrophic backtracking(a+)+$

Using Templates

  1. Click Examples in the header
  2. Select a template from the dropdown
  3. The pattern, flags, and sample test text are loaded
  4. Modify as needed for your use case

Learning from Templates

Each template demonstrates different regex concepts:

  • Basic matching — Email, phone, date patterns
  • Quantifiers — Various repetition strategies
  • Groups — Capturing, non-capturing, named groups
  • Lookaheads — Password validation with multiple requirements
  • Character classes — Custom and predefined classes
  • Anchors — Start/end of string matching
  • Backreferences — HTML tag matching with \1

Copy Pattern

The Copy button copies just the regex pattern (without flags or test text) to your clipboard. Useful when you need to paste the pattern into code.

Export

Signed-in users can export explanations in multiple formats:

  • Markdown — For documentation
  • PR Comment — GitHub-friendly collapsible format
  • Notion — Notion-compatible blocks
  • Plain Text — Simple text format

See Export Formats for details.

Keyboard Shortcut

Press Cmd/Ctrl + Shift + C to quickly copy the share link without clicking.