Free Developer Tool

Regex Tester

Test regular expression patterns on sample text, highlight matches, inspect capture groups and see replace results instantly.

All operations run in your browser. Your regex pattern and test text are not sent to a server.

Test your regular expression

Enter the pattern, the flag options and the test text using JavaScript RegExp syntax.

/ /

Test text

0 characters

Match preview

0 matches
Matching parts will be highlighted here.

You can use $& for the whole match, $1, $2 for numbered groups, and $<groupName> for named groups.

Number of matches 0
First match —
Capture group 0
Flags used gi

Match details

0 results
When the regex test is complete, the match position, value and capture groups will be listed here.

Regex Tester features

The core features you need to build, test and debug regular expressions and try out replace operations are offered on a single page.

.*

Regex pattern testing

Tests regular expressions written in JavaScript RegExp syntax on sample text.

Aa

Flag support

Supports the global, case-insensitive, multiline, dot-all and Unicode flag options.

✓

Match highlighting

Visually highlights the parts of the text that match the regex in the result area.

()

Capture groups

Shows the values of numbered and named capture groups separately.

↔

Replace preview

Lets you preview regex replace expressions in the result area before changing the original text.

⌁

Secure processing in the browser

Your regex pattern and test text are processed on your device and are not sent to any server.

What is the Regex Tester?

The Regex Tester is a free online developer tool that runs regular expression patterns on sample text, highlights the matching parts and displays capture groups.

Regex, or regular expression, is a special pattern language used to search for, validate, extract or replace specific character structures in text. Data with a specific format, such as email addresses, phone numbers, URLs, dates, usernames and log lines, can be detected with regex patterns.

Although regular expressions are powerful, they can become complex because of special characters, groups, quantifiers and flag options. With the Regex Tester you can instantly see which texts a pattern matches, where each match starts and which values the groups capture.

This tool uses the JavaScript RegExp engine. As a result, there may be minor syntax and feature differences compared with regex engines in other programming languages.

How to use the Regex Tester?

Follow the steps below to test your regular expression.

1

Enter the regex pattern

Type the regular expression you want to test into the regex field without slashes at the start and end.

2

Select the flag options

Enable the global, case-insensitive, multiline, dot-all or Unicode options as needed.

3

Add the test text

Type or paste the text to check the regex pattern against into the test field.

4

Review the results

Check the matches, character positions, capture groups and the replace preview.

Regex test example

The following regex pattern can be used to find basic email address structures in text.

Regex pattern

\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b

Test text

For project details, you can write to bilgi@teknodanisman.com or destek@teknodanisman.com.

Matches found

bilgi@teknodanisman.com
destek@teknodanisman.com

When the global g flag is enabled, all matches in the text are found. When the global flag is turned off, only the first match is reported.

Regex Flag Options

What do the regex flag options do?

Flag options determine how the regular expression works on the text and how matches are evaluated.

Flag Name Function Example use
g Global Finds all matches instead of stopping at the first one. Finding all email addresses in a text
i Ignore case Ignores the difference between uppercase and lowercase letters. Matching tekno with TEKNO
m Multiline Makes the ^ and $ anchors work on every line. Checking the start of each line
s Dot all Lets the dot character also match line breaks. Capturing multiline content blocks
u Unicode Makes the regex engine process the pattern according to Unicode rules. Matching emoji and Unicode code points
Regex Tester uses the JavaScript RegExp flag options. The same flag letter can appear only once in a regex expression.
Regex Syntax

Commonly used regex expressions

The following character classes, quantifiers and anchors are widely used in regular expressions.

.

Any character

By default, the dot matches any character except a line break.

\d

Digit character

The \d expression matches digit characters from zero to nine.

\w

Word character

\w matches letters, digits and the underscore character.

\s

Whitespace character

\s matches whitespace characters such as spaces, tabs and line breaks.

[abc]

Character class

Matches any one of the characters inside the square brackets.

[^abc]

Negated character class

Matches characters that are not listed inside the square brackets.

*

Zero or more

Allows the previous expression to repeat zero or more times.

+

One or more

Requires the previous expression to appear at least once.

?

Optional

Allows the previous expression to appear zero or one time.

{n,m}

Repetition range

Specifies that the previous expression repeats at least n and at most m times.

^ $

Start and end

^ denotes the start, and $ the end of the text or line.

()

Capture group

Groups multiple expressions and allows the matched value to be used later.

Common regex mistakes

1. Not escaping special characters

teknodanisman.com

In regex, the dot means any character. To match the literal dot in a domain name, use teknodanisman\.com.

2. Using an overly broad pattern

.*

This expression can match the widest possible content. To avoid unexpected results, character classes and boundaries should be defined more precisely.

3. Ignoring the behavior of the global flag

/\d+/

Without the global flag, only the first match is found. To find all number groups in the text, the g flag must be enabled.

4. Unclosed parenthesis or character class

(abc
[0-9

An unclosed parenthesis or square bracket causes a regex syntax error. The Regex Tester reports these errors during processing.

Where is regex used?

Regular expressions are used in many software development processes where specific character patterns need to be found, validated, extracted and replaced.

Form validation

Can be used to check the formats of email addresses, phone numbers, usernames, postal codes and passwords.

Log analysis

Used to extract IP addresses, error codes, timestamps and specific messages from log records.

Text search and replace

Enables bulk replacement of specific patterns in code editors or data files.

Data cleaning

Used to remove unnecessary whitespace, special characters or repeated text structures.

URL routing

Can be used on web servers to match URL patterns and create redirect rules.

Web scraping and data extraction

Can be used to extract specific values from structured text.

Frequently Asked Questions About the Regex Tester

Browse the answers to frequently asked questions about regular expressions, regex flag options, matches, capture groups and replace operations.

What is the Regex Tester used for?
The Regex Tester tests regular expression patterns on sample text, highlights the matching parts and shows match details.
What is regex?
Regex, or regular expression, is a pattern language used to find, validate, extract or replace specific character sequences in text.
Should I add slashes at the start and end of the regex pattern?
No. In this tool you only enter the pattern itself in the regex pattern field. The opening and closing slash characters are shown visually by the interface.
What does the regex global flag do?
The global g flag makes the regex engine find all matches in the text instead of stopping at the first one.
How do I write a case-insensitive regex?
To ignore the difference between uppercase and lowercase letters, use the i flag. The Case-insensitive option in the Regex Tester enables this flag.
What is a regex capture group?
Parts of a regex enclosed in parentheses form a capture group. These groups let you use the matched sub-values separately or refer to them again in a replace operation.
How do I use a named capture group?
In JavaScript regex, a named group is defined in the form (?<groupName>...). In a replace operation, this group can be used with the $<groupName> expression.
How do I perform a regex replace?
After entering the regex pattern and the test text, type the replacement text and click the Preview Replace button. You can use $& for the whole match and $1 and $2 for capture groups.
Why does a regex produce an error?
An unclosed parenthesis, a missing square bracket, an invalid quantifier, incorrect use of escapes or unsupported regex syntax can cause an error.
Is JavaScript regex the same as regex in other languages?
Although the basic syntax is largely similar, regex features can vary depending on the programming language and the regex engine used. This tool uses the JavaScript RegExp engine.
Is my test text sent to a server?
No. Regex tests and replace operations run directly in your browser. Your regex pattern and test text are not sent to a server.
Is the Regex Tester free?
Yes. You can use the Tekno Danışman Regex Tester for free and without registration.

Free Developer Tools

Free online tools you can use in software development, API integration, data conversion, testing and productivity workflows.