GenerateIt

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.

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!
RegEx Tester
/ \g

Flags







Results


Matches

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.


If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

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 \n in the string.
$
Matches the expression to its left at the end of a string. It matches every such instance before each \n in the string.
.
Matches any character except line terminators like \n.
\
Escapes special characters or denotes character classes.
A|B
Matches expression A or B. If A is matched first, B is 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 m times.
{m,n}
Matches the expression to its left from m to n times.
{m,n}?
Matches the expression to its left m times, ignoring n. 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 \w and \W.
\B
Matches positions where \b does 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, or c (not abc).
[a-z]
Matches any character from a to z.
[a\-z]
Matches a, -, or z.
[a-]
Matches a or -.
[-a]
Matches a or -.
[a-z0-9]
Matches characters from a to z and 0 to 9.
[(+*)]
Matches literal (, +, *, and ).
[^ab5]
Matches any character except a, b, or 5.

Groups

( )
Groups the expression inside the parentheses.
(? )
Extension notation. The meaning depends on the character following ?.
(?PAB)
Matches expression AB and allows access via a group name.
(?aiLmsux)
Inline flags:
  • a — ASCII only
  • i — Ignore case
  • L — Locale dependent
  • m — Multi-line
  • s — Dot matches all
  • u — Unicode
  • x — Verbose
(?:A)
Matches A without creating a retrievable capture group.
(?#...)
A comment. Content is ignored during matching.
A(?=B)
Positive lookahead. Matches A only if followed by B.
A(?!B)
Negative lookahead. Matches A only if not followed by B.
(?<=B)A
Positive lookbehind. Matches A only if preceded by B.
(?<!B)A
Negative lookbehind. Matches A only if not preceded by B.
(?P=name)
Matches the text captured by the earlier named group name.
(...)\1
Backreference to the first captured group. You can reference groups 1 through 99.

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.

  1. 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.
  2. To test a regex expression, just enter the regular expression into the field above.
  3. Select which flags you would like to include with the regex expression.
  4. You can then enter the test data into the textarea.
  5. Finally click on 'Match' to view if your regular expression is working correctly.
If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!