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 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!
Manual Regex Builder
Build your regex pattern step by step using components
Current Pattern
Basic Characters
Click any component to add to your pattern
.
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
*
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
[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
^
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
()
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
\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
Email Address
Validates email addresses
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
Phone Number (US)
US phone number formats
\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}
URL/Website
HTTP/HTTPS URLs
https?:\/\/(www\.)?[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
IPv4 Address
IPv4 network addresses
\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b
Regex Tester
Test your regular expressions with live matching and validation
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