RegEx Tester
Regular expressions (often shortened to regex or regexp) are a powerful and flexible way to search, match, extract, and manipulate text. By defining a specific pattern made up of ASCII or Unicode characters, you can quickly identify one or more matches within large blocks of text that would otherwise be difficult to process manually.
Regex is widely used across many applications, including input validation, string parsing and replacement, data transformation, log analysis, and web scraping. Whether you are checking if an email address is valid, extracting values from structured text, or reformatting content, regular expressions provide an efficient and precise solution.
With this tool, you can enter a regular expression and test it instantly against your own sample text to see exactly how it behaves. Matches are highlighted in real time, allowing you to fine-tune your pattern and understand the results more clearly. If you’re new to regex or just need a quick reference, you can also scroll down to try one of the built-in examples and see how common patterns work in practice.
This regex tester is ideal for developers, students, and anyone working with text who wants a fast, visual, and interactive way to experiment with regular expressions and improve accuracy.
RegEx Tester
Flags
Results
Examples to Try
Try some of the examples below to get a feel about how this RegEx Tester works. Just click on the button below for for the examples to appear in the input fields above. Play around with the regular expressions and you'll soon see what is happening.
About Regular Expressions
Learn more about Regex by using the cheat sheet below, with explanations for each character that is used in regular expressions.
Special Characters
^- Matches the expression to its right at the start of a string. It matches every such instance before each
\nin the string. $- Matches the expression to its left at the end of a string. It matches every such instance before each
\nin the string. .- Matches any character except line terminators like
\n. \- Escapes special characters or denotes character classes.
A|B- Matches expression
AorB. IfAis matched first,Bis left untried. +- Greedily matches the expression to its left 1 or more times.
*- Greedily matches the expression to its left 0 or more times.
?-
Greedily matches the expression to its left 0 or 1 times.
If
?is added to qualifiers (+,*, and?itself) it performs a non-greedy match. {m}- Matches the expression to its left exactly
mtimes. {m,n}- Matches the expression to its left from
mtontimes. {m,n}?- Matches the expression to its left
mtimes, ignoringn. See?above.
Character Classes (Special Sequences)
\w- Matches alphanumeric characters (
a-z,A-Z,0-9) and underscore (_). \d- Matches digits (
0-9). \D- Matches any non-digit character.
\s- Matches whitespace characters such as
\t,\n,\r, and space. \S- Matches non-whitespace characters.
\b- Matches a word boundary between
\wand\W. \B- Matches positions where
\bdoes not match. \A- Matches the expression to its right at the absolute start of a string.
\Z- Matches the expression to its left at the absolute end of a string.
Sets
[ ]- Contains a set of characters to match.
[abc]- Matches
a,b, orc(notabc). [a-z]- Matches any character from
atoz. [a\-z]- Matches
a,-, orz. [a-]- Matches
aor-. [-a]- Matches
aor-. [a-z0-9]- Matches characters from
atozand0to9. [(+*)]- Matches literal
(,+,*, and). [^ab5]- Matches any character except
a,b, or5.
Groups
( )- Groups the expression inside the parentheses.
(? )- Extension notation. The meaning depends on the character following
?. (?PAB)- Matches expression
ABand allows access via a group name. (?aiLmsux)-
Inline flags:
a— ASCII onlyi— Ignore caseL— Locale dependentm— Multi-lines— Dot matches allu— Unicodex— Verbose
(?:A)- Matches
Awithout creating a retrievable capture group. (?#...)- A comment. Content is ignored during matching.
A(?=B)- Positive lookahead. Matches
Aonly if followed byB. A(?!B)- Negative lookahead. Matches
Aonly if not followed byB. (?<=B)A- Positive lookbehind. Matches
Aonly if preceded byB. (?<!B)A- Negative lookbehind. Matches
Aonly if not preceded byB. (?P=name)- Matches the text captured by the earlier named group
name. (...)\1- Backreference to the first captured group. You can reference groups
1through99.
How to Use?
The online regex tester is a handy tool to help you learn and check regex codes before using them in your projects.
- If you are new to regex, it might come in useful to check out the some of the examples on this webpage, just to get a feel of how they work.
- To test a regex expression, just enter the regular expression into the field above.
- Select which flags you would like to include with the regex expression.
- You can then enter the test data into the textarea.
- Finally click on 'Match' to view if your regular expression is working correctly.

