Use this free online Regular Expression Tester to test, validate, and debug regular expressions against sample text instantly. Whether you are building search patterns, validating user input, extracting data, or performing text replacements, this tool helps you verify that your regular expressions work exactly as expected.
Simply enter your regular expression pattern, provide the text to test against, select any regex flags you need, and instantly see matching results. You can also test replacement operations and troubleshoot patterns before using them in your applications.
Key Features Of This Tool
- Test regular expressions against text and instantly see matching results.
- Perform text replacement using regular expression patterns with an optional replacement field.
- Enable or disable common regex flags, including case-insensitive (
i), multiline (m), global (g), and dot matches all (s). - Matched text is highlighted to make it easy to identify successful pattern matches.
- Copy your regular expression, test text, or results with a single click.
Regular Expression (Regex) Reference Guide
Regular expressions (Regex) are pattern-matching rules used to search, validate, extract, or replace text. Whether you’re checking email addresses, validating passwords, filtering data, or finding specific words, regular expressions provide a fast and flexible solution.
The table below explains the most commonly used regex symbols and what they represent.
| Regex Pattern | Description |
|---|---|
| Escapes special characters so they are treated as ordinary text. It is also used to introduce special sequences such as d, w, and s. |
^ | Matches the start of a string. Inside square brackets ([^...]), it means “exclude these characters.” |
$ | Matches the end of a string or line. |
* | Repeats the previous character or group zero or more times. |
+ | Requires the previous character or group to appear one or more times. |
? | Makes the previous item optional. When used after another quantifier, it performs the shortest possible match (lazy matching). |
. | Represents any single character except a newline in most regex engines. |
(pattern) | Groups expressions together and stores the matched value for later use (capturing group). |
(?:pattern) | Groups expressions without saving the matched value (non-capturing group). |
(?=pattern) | Positive lookahead. Ensures the following text matches without including it in the result. |
(?!pattern) | Negative lookahead. Ensures the following text does not match. |
x|y | Matches either the expression before or after the pipe symbol. |
{n} | Matches the preceding item exactly n times. |
{n,m} | Matches the preceding item between n and m times. |
{n,} | Matches the preceding item at least n times. |
{,m} | Matches the preceding item up to m times (supported in some regex flavors). |
[abc] | Matches any one character listed inside the brackets. |
[^abc] | Matches any character except those inside the brackets. |
[A-Z] | Matches any uppercase letter within the specified range. |
[0-9] | Matches any numeric digit from 0 through 9. |
b | Matches the boundary between a word character and a non-word character. |
B | Matches positions that are not word boundaries. |
[b] | Matches the backspace control character rather than a word boundary. |
d | Matches any decimal digit (0–9). |
D | Matches any character that is not a digit. |
w | Matches letters, digits, and the underscore character. |
W | Matches any character that is not a letter, digit, or underscore. |
s | Matches whitespace characters including spaces, tabs, and line breaks. |
S | Matches any character that is not whitespace. |
t | Matches a horizontal tab character. |
n | Matches a newline character. |
r | Matches a carriage return character. |
f | Matches a form feed character. |
v | Matches a vertical tab character. |
cX | Matches a control character, where X is a letter from A to Z. |
|