ewory.com logo

Regex Tester

Enter a regex pattern and test string. Matches are highlighted in real time. Toggle flags to change matching behavior.


//gi

Highlighted Matches

Contact us at hello@example.com or support@company.org for help.

Matches: 2

Match 1: hello@example.com
Index: 14
Match 2: support@company.org
Index: 35

Regex Tester – Test Regular Expressions Online

Regular expressions (regex) are powerful patterns used for searching, validating, and extracting text. This free regex tester lets you write and debug regex patterns in real time — matching is highlighted instantly as you type. It supports JavaScript regex syntax with global, case-insensitive, multiline, and dotall flags.

What Are Regular Expressions?

A regular expression is a sequence of characters that defines a search pattern. They are used in programming, text editors, command-line tools, and databases to find, replace, or validate strings. Common use cases include:

  • Validating email addresses, phone numbers, and URLs
  • Extracting data from logs and structured text
  • Search-and-replace operations in code editors
  • Input validation in web forms
  • Web scraping and data parsing

Regex is supported in nearly every programming language including JavaScript, Python, Java, C#, PHP, Ruby, Go, and Rust.

Common Regex Patterns

PatternDescriptionExample Match
.Any character except newlinea, 1, @
\dAny digit (0-9)5, 0, 9
\wWord character (a-z, A-Z, 0-9, _)a, Z, 3, _
\sWhitespace (space, tab, newline)(space), \t
[abc]Character class: a, b, or ca, b, c
[^abc]Not a, b, or cd, 1, @
a|ba or ba, b
^Start of string/line(position)
$End of string/line(position)

Quantifiers

QuantifierMeaningExample
*0 or morea* matches "", "a", "aaa"
+1 or morea+ matches "a", "aaa"
?0 or 1 (optional)a? matches "", "a"
{n}Exactly na{3} matches "aaa"
{n,m}Between n and ma{2,4} matches "aa", "aaa", "aaaa"

Regex Flags Explained

  • g (global): Find all matches, not just the first one
  • i (case-insensitive): Match uppercase and lowercase letters interchangeably
  • m (multiline): ^ and $ match the start/end of each line, not just the entire string
  • s (dotall): Makes the . metacharacter match newline characters as well

Useful Regex Examples

Use CasePattern
Email address[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Z|a-z]{2,}
URLhttps?://[^\s]+
Phone number (US)(?\d{3})?[-.\s]?\d{3}[-.\s]?\d{4}
IP address\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}
HTML tags<[^>]+>
Hex color code#[0-9A-Fa-f]{3,8}
Date (YYYY-MM-DD)\d{4}-\d{2}-\d{2}

Frequently Asked Questions

What is a regular expression?

A regular expression (regex) is a pattern that describes a set of strings. It's used for searching, matching, and manipulating text in programming languages, text editors, and command-line tools.

What regex flavor does this tester use?

This tester uses JavaScript's built-in RegExp engine, which supports standard regex syntax including character classes, quantifiers, groups, lookaheads, and lookbehinds in modern browsers.

What does the global (g) flag do?

The global flag finds all matches in the text instead of stopping after the first match. Without it, only the first occurrence is returned.

How do I match a literal dot or special character?

Escape special characters with a backslash. For example, \. matches a literal dot, \( matches a literal parenthesis, and \\ matches a literal backslash.

What are capturing groups?

Capturing groups use parentheses ( ) to extract specific parts of a match. For example, (\d{4})-(\d{2})-(\d{2}) captures the year, month, and day separately from a date string.

Sources