Productive Toolbox

RegEx Tester

Test regular expressions with live highlighting, capture groups, and replacement preview

🔍

RegEx Tester

Test regular expressions with live highlighting, capture groups, and replacement preview. All processing happens locally in your browser.

Regular Expression

Test String

105 characters

Replacement

Export & Actions

Keyboard Shortcuts

Ctrl+Enter Run test
Ctrl+L Clear all
Ctrl+/ Toggle cheat sheet

About RegEx Tester

The RegEx Tester is a powerful, browser-based tool for testing and debugging regular expressions. Whether you are a beginner learning regex or an advanced developer optimizing complex patterns, this tool provides instant visual feedback with live highlighting, capture group inspection, and replacement preview. All processing happens entirely in your browser with no server required.

Key Features

  • Real-time Testing: See results instantly as you type your regex pattern
  • Live Match Highlighting: Matches are highlighted directly in the test text
  • Capture Groups: View all captured groups for each match
  • Match Navigation: Jump between matches with next/previous buttons
  • Replacement Preview: See how replacements will look before applying
  • Regex Flags: Toggle g, i, m, s, u, y flags with descriptions
  • Error Handling: Clear error messages for invalid patterns
  • Regex Cheat Sheet: Quick reference for common patterns and syntax
  • Example Templates: Pre-built patterns for email, phone, URL, date, IPv4, etc.
  • History: Save and reload your last 20 regex tests
  • Export Options: Download matches as JSON or CSV
  • Keyboard Shortcuts: Ctrl+Enter to test, Ctrl+L to clear, Ctrl+/ for cheat sheet
  • Large Text Support: Handle 200,000+ character inputs efficiently
  • 100% Client-Side: All processing happens in your browser

How to Use

  1. Enter Regex Pattern: Type your regular expression in the Pattern field. For example: type digits to match numbers.
  2. Select Flags: Check the flags you need (g for global, i for case-insensitive, etc.). Hover over each flag to see its description.
  3. Enter Test Text: Paste or type the text you want to test the regex against.
  4. View Results: Matches appear instantly with their positions and captured groups.
  5. Navigate Matches: Use Previous/Next buttons to jump between matches.
  6. Test Replacements: Enter a replacement string to preview how replacements will look.
  7. Export Results: Download matches as JSON or CSV for further processing.

Understanding Regular Expressions

Regular expressions (regex) are patterns used to match character combinations in strings. They are powerful tools for text processing, validation, and data extraction.

Basic Syntax

Regex patterns use special characters to define what to match:

  • Backslash-d matches any digit (0-9)
  • Backslash-w matches word characters (a-z, A-Z, 0-9, underscore)
  • Backslash-s matches whitespace
  • Period matches any character except newline
  • Asterisk means zero or more
  • Plus means one or more
  • Question mark means zero or one

Flags

Flags modify how the regex behaves:

  • g (global) - find all matches, not just the first
  • i (case-insensitive) - ignore uppercase/lowercase differences
  • m (multiline) - caret and dollar match line boundaries, not just string boundaries
  • s (dotall) - period matches newlines
  • u (unicode) - treat pattern as Unicode
  • y (sticky) - match from lastIndex position

Common Use Cases

Email Validation

Matches valid email addresses like john@example.com

Phone Number

Matches phone numbers in XXX-XXX-XXXX format like 123-456-7890

URL Extraction

Matches HTTP and HTTPS URLs in text

Date Format (YYYY-MM-DD)

Matches dates like 2026-03-13

IPv4 Address

Matches IP addresses like 192.168.1.1

Extract Numbers

Matches all numbers in text

Capture Groups

Capture groups allow you to extract specific parts of a match. They are created using parentheses.

Example:

Pattern: (word)+@(word+.word+)

Text: john@example.com

Results:

Group 0 (full match): john@example.com

Group 1: john

Group 2: example.com

Replacement Patterns

When replacing matches, you can use special replacement patterns to reference matched text and groups.

  • Dollar-ampersand - the entire matched string
  • Dollar-1, Dollar-2, etc. - captured groups
  • Dollar-backtick - text before the match
  • Dollar-apostrophe - text after the match

Example:

Pattern: digits

Text: Price is 100 USD

Replace with: [matched]

Result: Price is [100] USD

Performance Tips

  • Use specific patterns: Specific patterns are faster than generic ones
  • Avoid backtracking: Use atomic groups or possessive quantifiers when possible
  • Test with realistic data: Use actual data similar to what you will process
  • Use the global flag: When you need all matches, use the g flag
  • Anchor patterns: Use caret and dollar to limit search scope

Keyboard Shortcuts

Ctrl+Enter (or Cmd+Enter on Mac): Run the regex test
Ctrl+L (or Cmd+L on Mac): Clear all inputs
Ctrl+/ (or Cmd+/ on Mac): Toggle the regex cheat sheet

Export Options

Export as JSON

Download all matches with their positions and capture groups in JSON format for programmatic processing.

Export as CSV

Download matches in CSV format for spreadsheet applications like Excel or Google Sheets.

History and Recent Tests

The tool automatically saves your last 20 regex tests in browser localStorage. You can quickly reload any previous test by clicking on it in the history panel. This is useful for iterating on complex patterns or comparing different approaches.

Security and Privacy

Your privacy is important:

  • 100% Client-Side: All regex processing happens in your browser
  • No Server Communication: Nothing is sent to any server
  • No Tracking: We do not track what patterns you test
  • Local Storage Only: History is stored only in your browser
  • No Third-Party Scripts: No analytics or tracking code

Common Errors and Solutions

Unterminated group

Make sure all opening parentheses have matching closing parentheses.

Invalid escape sequence

Some characters need to be escaped with a backslash. For example, use backslash-period to match a literal period.

No matches found

Your pattern might be too specific. Try using more general patterns or check if your test text contains the expected data.

Greedy vs Non-greedy

By default, quantifiers are greedy. Use non-greedy versions for non-greedy matching.

Browser Compatibility

This tool works in all modern browsers including Chrome, Firefox, Safari, Edge, and Opera. The RegExp engine uses JavaScript native implementation, which is supported in all browsers released after 2015. All features including capture groups, flags, and replacements are fully supported.

Frequently Asked Questions

Can I test complex regex patterns?

Yes! The tool supports all JavaScript regex features including lookahead, lookbehind, named groups, and more.

How large can my test text be?

The tool can handle 200,000+ characters efficiently. Very large texts may take a moment to process.

Is my data stored anywhere?

No, all processing happens in your browser. Only your history is stored locally in your browser localStorage.

Can I use this offline?

Yes, once the page loads, all functionality works offline. No internet connection is required.

What is the difference between global and non-global matching?

Without the g flag, only the first match is returned. With g, all matches are found.