Regex Tester | Test Regular Expressions Online

Free online Regex Tester. Test and debug regular expressions with real-time highlighting, match details, and a quick reference cheatsheet.

Global search
Case-insensitive search
Multi-line search
Allows . to match newline characters
Unicode; treat pattern as a sequence of Unicode code points
Sticky search
/
/gm

Match Information

StatusNo Match
Match Count0
Execution Time0.00ms

Cheatsheet

Common Patterns

.*Any character (0 or more)
.+Any character (1 or more)
^$Empty string
\r\nWindows newline

Character Classes

.Any character except newline
\dDigit (0-9)
\DNot a Digit
\wWord character (a-z, A-Z, 0-9, _)
\WNot a Word character
\sWhitespace (space, tab, newline)
\SNot Whitespace
\tTab
\nNewline
\p{L}Unicode Letter
\p{P}Unicode Punctuation
\p{N}Unicode Number
\p{Sc}Unicode Currency Symbol

Character Sets

[abc]Any of a, b, or c
[^abc]Not a, b, or c
[a-z]Character range (a to z)
[A-Z]Character range (A to Z)
[0-9]Character range (0 to 9)

Anchors

^Start of string/line
$End of string/line
\bWord boundary
\BNot a word boundary

Quantifiers

*0 or more
+1 or more
?0 or 1
{3}Exactly 3
{3,}3 or more
{3,5}3 to 5
*?Lazy match (0 or more)
+?Lazy match (1 or more)

Groups & Lookaround

(abc)Capturing group
(?:abc)Non-capturing group
(?<name>abc)Named capturing group
(?=abc)Positive Lookahead
(?!abc)Negative Lookahead
(?<=abc)Positive Lookbehind
(?<!abc)Negative Lookbehind

Escaping

\Escape following character
\.Literal dot
\*Literal asterisk
\+Literal plus
\?Literal question mark
\^Literal caret
\$Literal dollar
\[Literal bracket
\(Literal parenthesis
\Q...\EQuote literal sequence

Validation Patterns

^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$Email Address
^https?:\/\/[\w\d\-_]+(\.[\w\d\-_]+)+Simple URL
^\d{4}-\d{2}-\d{2}$Date (YYYY-MM-DD)
^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$Hex Color
^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$IPv4 Address
^[a-zA-Z0-9_-]{3,16}$Username (3-16 chars)

Related Tools

What is Regex Tester?

A Regex Tester is a tool that allows you to test regular expressions (regex) against a target string, highlighting matches and providing details about captured groups.

Key Features

**Real-time Highlighting:** See matches instantly as you type.
**Match Details:** View index and captured groups for each match.
**Cheatsheet:** Quick reference for common regex patterns.
**Code Generator:** Generate regex code for 15+ programming languages.
Shareable LinksShare regex patterns and test strings via link. (Limit: 5KB)

How to Use

1

Enter your regular expression pattern.

2

Select flags (Global, Multiline, Case Insensitive, etc.).

3

Type or paste your test string.

4

View highlighted matches and details.

Examples

Input

=== CHARACTER CLASSES ===
Pattern: \d+          Text: "Order #12345"         → Matches: 12345
Pattern: \w+          Text: "hello_world"          → Matches: hello_world
Pattern: \s           Text: "a b"                  → Matches: (space)
Pattern: .            Text: "abc"                  → Matches: a, b, c

=== ANCHORS ===
Pattern: ^Hello       Text: "Hello World"          → Matches: Hello (at start)
Pattern: World$       Text: "Hello World"          → Matches: World (at end)
Pattern: \bword\b     Text: "a word here"          → Matches: word (whole word)

=== QUANTIFIERS ===
Pattern: a+           Text: "caaandy"              → Matches: aaa
Pattern: a*           Text: "cdy"                  → Matches: (empty)
Pattern: a?           Text: "candy"                → Matches: a
Pattern: a{2,4}       Text: "caaaandy"             → Matches: aaaa

=== GROUPS & LOOKAROUND ===
Pattern: (ab)+        Text: "ababab"               → Matches: ababab
Pattern: (?=USD)      Text: "100 USD"              → Matches: position before USD
Pattern: (?<=\$)\d+   Text: "$100"                 → Matches: 100

=== VALIDATION PATTERNS ===
Email:   [\w.-]+@[\w.-]+\.[a-z]{2,}
IPv4:    (?:\d{1,3}\.){3}\d{1,3}
Date:    \d{4}-\d{2}-\d{2}
Hex:     #[0-9a-fA-F]{3,6}

Output

=== SAMPLE MATCHES ===

Email Pattern on: "Contact: [email protected], [email protected]"
  Match 1: [email protected]
  Match 2: [email protected]

\d+ Pattern on: "Price: $49.99, Qty: 3"
  Match 1: 49
  Match 2: 99
  Match 3: 3

\b\w{4}\b Pattern on: "The quick brown fox"
  Match 1: quick (skips "The" - 3 chars, "brown" - 5 chars)
  No match: "fox" (3 chars)
  
^Start on: "Start here\nStart again" (multiline)
  Match 1: Start (line 1)
  Match 2: Start (line 2)

Frequently Asked Questions

Which regex flavor is supported?
This tool uses JavaScript's built-in RegExp engine.