Regexr

Regex Builder & Tester

The ultimate all-in-one tool to create, test, and master regular expressions. From AI-powered generation to manual building and comprehensive testing.

AI Powered
Interactive
Real-time Testing

๐Ÿค– AI Regex Generator

๐Ÿ’ก

How to Use AI Generation

Describe what you want to match in plain English, and I'll suggest regex patterns! I understand many variations and synonyms. No quotes needed - just type naturally!

โœ“ Try these examples:
โ€ข validate emails
โ€ข extract phone numbers
โ€ข match website links
โ€ข find credit cards
โ€ข check passwords
โ€ข get dates from text
๐Ÿ’ก I understand:
โ€ข Synonyms (emails = e-mails)
โ€ข Plurals (phone = phones)
โ€ข Action words (find, extract, match)
โ€ข Common variations

Manual Regex Builder

Build your regex pattern step by step using components

Current Pattern
Empty

Current Pattern

Click components below to build your regex pattern...
๐Ÿ”ค

Basic Characters

Click any component to add to your pattern

7 items
.

Any character except newline

a.c matches "abc", "axc"

\d

Any digit (0-9)

\d+ matches "123", "7"

\w

Word character (letter, digit, underscore)

\w+ matches "hello", "test_123"

\s

Whitespace character

\s+ matches spaces, tabs

\D

Non-digit character

\D+ matches "abc", "xyz"

\W

Non-word character

\W+ matches "!@#", "..."

\S

Non-whitespace character

\S+ matches "hello", "123"

๐Ÿ”ข

Quantifiers

Click any component to add to your pattern

8 items
*

Zero or more

a* matches "", "a", "aaa"

+

One or more

a+ matches "a", "aaa"

?

Zero or one

a? matches "", "a"

{n}

Exactly n times

a{3} matches "aaa"

{n,}

n or more times

a{2,} matches "aa", "aaa"

{n,m}

Between n and m times

a{2,4} matches "aa", "aaa"

*?

Non-greedy zero or more

Lazy matching

+?

Non-greedy one or more

Lazy matching

๐Ÿ“

Character Classes

Click any component to add to your pattern

7 items
[abc]

Any character in brackets

[abc] matches "a", "b", "c"

[^abc]

Any character NOT in brackets

[^abc] matches "d", "e", "f"

[a-z]

Character range

[a-z] matches lowercase letters

[A-Z]

Uppercase letters

[A-Z] matches "A", "B", "C"

[0-9]

Digit range

[0-9] matches any digit

[a-zA-Z]

All letters

Matches any letter

[a-zA-Z0-9]

Alphanumeric

Letters and numbers

โš“

Anchors

Click any component to add to your pattern

6 items
^

Start of string/line

^hello matches "hello world"

$

End of string/line

world$ matches "hello world"

\b

Word boundary

\bcat\b matches "cat" not "category"

\B

Non-word boundary

\Bcat\B matches "category"

\A

Start of string only

Beginning of entire string

\Z

End of string only

End of entire string

๐Ÿ”—

Groups & Alternation

Click any component to add to your pattern

7 items
()

Capturing group

(abc) captures "abc"

(?:)

Non-capturing group

(?:abc) groups without capture

|

Alternation (OR)

cat|dog matches "cat" or "dog"

(?=)

Positive lookahead

a(?=b) matches "a" followed by "b"

(?!)

Negative lookahead

a(?!b) matches "a" not followed by "b"

(?<=)

Positive lookbehind

(?<=a)b matches "b" preceded by "a"

(?<!)

Negative lookbehind

(?<!a)b matches "b" not preceded by "a"

โญ

Special Characters

Click any component to add to your pattern

8 items
\n

Newline character

Line break

\t

Tab character

Tab space

\r

Carriage return

Return character

\.

Literal dot

Escapes the dot metacharacter

\*

Literal asterisk

Escapes the * metacharacter

\+

Literal plus

Escapes the + metacharacter

\?

Literal question mark

Escapes the ? metacharacter

\\

Literal backslash

Escapes the backslash

๐Ÿ’ก Quick Tips for Manual Building

๐ŸŽฏ Building Strategy

Start with basic characters, add quantifiers, then use anchors to position your pattern precisely.

๐Ÿ” Testing as You Go

Test your pattern after each addition to understand how components interact with each other.

โšก Common Patterns

Email: ^[\\w.-]+@[\\w.-]+\\.[a-zA-Z]{2,}$ | Phone: ^\\d{3}-\\d{3}-\\d{4}$

๐Ÿ›ก๏ธ Escaping Characters

Use backslash (\\) to escape special characters when you want their literal meaning.

๐Ÿ“š Preset Patterns

4 patterns

Email Address

Pattern

Validates email addresses

Regex Pattern:
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
Example Match:
user@example.com

Phone Number (US)

Pattern

US phone number formats

Regex Pattern:
\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}
Example Match:
(555) 123-4567

URL/Website

Pattern

HTTP/HTTPS URLs

Regex Pattern:
https?:\/\/(www\.)?[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
Example Match:
https://www.example.com

IPv4 Address

Pattern

IPv4 network addresses

Regex Pattern:
\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b
Example Match:
192.168.1.1

Regex Tester

Test your regular expressions with live matching and validation

Matches Found
0

Regular Expression Pattern

Test Text

Results

๐ŸŽฏ

Enter a regex pattern to see results

๐Ÿ’ก Testing Tips

๐ŸŽฏ Pattern Building

Start simple and build complexity gradually. Test each addition to understand its effect.

๐Ÿ” Flag Usage

Global flag finds all matches, ignore case for case-insensitive matching, multiline for line-by-line processing.

๐Ÿ“ Test Data

Use varied test data including edge cases, empty strings, and unexpected input formats.

โšก Performance

Avoid catastrophic backtracking with careful quantifier placement and non-greedy matching.

๐Ÿ“

No Pattern to Export

Create a regex pattern first to generate code snippets