Regex Tester

Test regular expressions online with matching, capture groups, highlighted preview, replacement, and common pattern library.

Regex Configuration

No need to wrap with slashes; enter the pattern directly
Supports $1, $2 and other capture group references

Common Patterns

Email Address[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
URLhttps?://[^\s]+
IPv4 Address\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
Phone Number1[3-9]\d{9}
ID Number\d{17}[\dXx]
Date\d{4}-\d{2}-\d{2}
Time\d{2}:\d{2}:\d{2}
Hex Color#[0-9a-fA-F]{6}
Number-?\d+(?:\.\d+)?
Chinese Characters[\u4e00-\u9fa5]+

Match Results

Please enter a regular expression

Usage Guide

Features

A regular expression testing tool for real-time regex matching. Enter a regex pattern and test string to automatically compute all matches, showing match positions, match contents, and capture groups with yellow-highlighted match segments. Also supports replacement mode preview and quick pattern insertion.

Steps

  1. Enter a pattern in the "Regular Expression" field (no slashes needed).
  2. Select flags as needed (g for global match is default).
  3. Paste the text to match in the "Test String" field; match results and highlight preview will display below in real-time.
  4. To use replacement, enter the replacement string in the "Replace Pattern" field (supports $1, $2 etc. capture group references).
  5. Click any card in "Common Patterns" to quickly insert a preset pattern.

Flag Descriptions

  • g - g Global
  • i - i Ignore case
  • m - m Multiline
  • s - s Single line
  • u - u Unicode
  • y - y Sticky

Notes

If g is not selected and multiple matches exist, only the first is returned. Replacement automatically enables the g flag to replace all matches. Zero-width matches (e.g., lookahead) are displayed with position indicators. All matching is done locally in the browser; data is not uploaded to any server.