Features
Pattern Testing

Pattern Testing

RegexLens provides real-time regex testing with instant visual feedback. As you type your pattern, matches are highlighted immediately in your test text.

Live Match Highlighting

Every match is highlighted in your test text with distinct colors:

  • Full matches are highlighted with the primary color
  • Capture groups each get their own color for easy identification
  • Named groups display their names alongside the match

Example: Phone Number Matching

Pattern:

\((\d{3})\)\s*(\d{3})-(\d{4})

Test text:

Call us at (555) 123-4567 or (800) 555-1234

RegexLens will highlight both phone numbers and show you:

  • Group 1: 555 and 800 (area codes)
  • Group 2: 123 and 555 (exchange)
  • Group 3: 4567 and 1234 (subscriber)

Try this pattern → (opens in a new tab)

Regex Flags

Toggle any combination of JavaScript regex flags:

FlagNameDescription
gGlobalFind all matches, not just the first
iCase InsensitiveMatch regardless of case
mMultiline^ and $ match line boundaries
sDotAll. matches newlines
uUnicodeEnable full Unicode support
yStickyMatch only at lastIndex position

Flag Combinations

Common flag combinations for different use cases:

gi  - Find all matches, case-insensitive (most common)
gm  - Find all matches across multiple lines
gis - Find all matches including newlines in .

Match List

Below the test text, RegexLens displays a detailed match list showing:

  • Match index (0, 1, 2, ...)
  • Full match text
  • Start and end positions in the test text
  • Capture groups with their values
  • Named groups with their names and values

Truncation Protection

To keep the UI responsive, RegexLens limits:

  • Maximum 1,000 matches displayed
  • Maximum 50,000 characters in test text
  • Maximum 2,000 characters in pattern

If your pattern produces more matches, you'll see a "(truncated)" indicator.

Token Toolbar

Quickly insert common regex tokens with the toolbar below the pattern input:

TokenMeaning
\dAny digit (0-9)
\wWord character (a-z, A-Z, 0-9, _)
\sWhitespace (space, tab, newline)
.Any character (except newline)
+One or more
*Zero or more
?Zero or one (optional)
{}Exact quantifier
()Capture group
(?:)Non-capturing group
[]Character class
^Start anchor
$End anchor
|Alternation (OR)
\bWord boundary

Click any token to append it to your current pattern.

Keyboard Shortcuts

Speed up your workflow with keyboard shortcuts:

ShortcutAction
/Focus the regex editor
Cmd/Ctrl + EnterForce re-parse
EscapeClear selection
Cmd/Ctrl + Shift + CCopy share link

Error Handling

When your pattern has a syntax error, RegexLens shows:

  1. Red underline on the problematic part of the pattern
  2. Error message explaining what's wrong
  3. Error position so you know exactly where to fix

Common errors detected:

  • Unmatched parentheses ( or )
  • Invalid escape sequences \q
  • Invalid quantifiers {3,1} (min > max)
  • Unterminated character classes [abc