Regex Tester

/ /

Test Text

Match Result

0 matches

Match Details

Features

Real-time Match

Enter regex and test text to instantly display match results

Highlight Display

Matched content highlighted, easy to see match positions

Match Statistics

Display match count and detailed info of each match

Group Capture

Support capture groups, display each group's match content

Flags Support

Support g(global), i(ignore case), m(multiline) etc. flags

Local Processing

All operations done locally in browser, protects data privacy

How to Use

1

Enter Regular Expression

Enter the regex to test in regex input box, can also click flag buttons to quickly add g, i, m flags.

2

Enter Test Text

Enter text content to test in test text box, or click "Sample" button to load sample text for quick experience.

3

View Match Results

Tool will real-time highlight display matched content, show match count and detailed info, including each match's position and captured group content.

Use Cases

Form Validation

Validate email, phone, ID card etc. input formats

Text Search

Find specific pattern content in large text

String Extraction

Extract needed data fragments from text

Text Replacement

Batch replace content matching pattern in text

Data Cleaning

Clean and normalize text data format

Route Matching

URL route rule matching in Web frameworks

Regular Expression Knowledge

What is Regular Expression?

Regular Expression (Regex or RegExp) is a pattern used to match character combinations in strings. It uses a single string to describe and match a series of strings that conform to certain syntax rules, is a powerful tool for text processing and data validation.

Example:^\d{3}-\d{4}-\d{4}$ can match phone format like 138-1234-5678

What are common regex metacharacters?

. matches any character (except newline); * matches previous character 0 or more times; + matches previous character 1 or more times; ? matches previous character 0 or 1 time; ^ matches string start; $ matches string end; \d matches digit; \w matches letter digit underscore; \s matches whitespace character.

What do regex flags do?

g (global): global match, find all matches; i (ignoreCase): ignore case; m (multiline): multiline mode, ^ and $ match each line's start and end; s (dotAll): make . match all characters including newline.

Frequently Asked Questions

Q: Is regex tester free?
A: Completely free, no registration login required, no usage limit, open webpage to use. All operations done locally in your browser, won't upload to server.
Q: What does g flag do in regex?
A: g (global) flag means global match, without g, regex will only match first result meeting condition; with g will match all results meeting condition.
Q: How to match Chinese characters?
A: Can use [\u4e00-\u9fa5] to match Chinese characters. For example /^[\u4e00-\u9fa5]+$/ can match pure Chinese string.
Q: What are capture groups?
A: Capture groups are regex parts enclosed in parentheses (), can extract specific parts from match results. First parenthesis is group 1, second is group 2, etc.
Q: How to validate email format?
A: Common email regex: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/. But perfect email validation is very complex, recommend combining with sending verification email method.
Q: Will my test data be saved?
A: No. All operations done locally in your browser, data won't be uploaded to any server, not recorded. Please use with confidence.