Regex Tester
Test regular expressions and find matches in text
Regex Tester
Test regular expressions and find matches in text
π― Regex Pattern
//
Common flags: g (global), i (case-insensitive), m (multiline), s (dotall)
π Test Text
π Matches
5
matches found
β
Position
Pattern:
/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/gi
Status:
regexTester.validPatternπ― Matches
Here are some email addresses to test:
john.doe@example.com
jane_smith@test.org
invalid.email@
user123@domain.co.uk
another@example.com
notanemail.com
admin@sub.domain.net
Groups:
# | Match | Position | Length | Groups |
---|---|---|---|---|
1 | john.doe@example.com | 39 | 20 | none |
2 | jane_smith@test.org | 60 | 19 | none |
3 | user123@domain.co.uk | 95 | 20 | none |
4 | another@example.com | 116 | 19 | none |
5 | admin@sub.domain.net | 151 | 20 | none |
π Replace
Use $1, $2, etc. to reference capture groups
Here are some email addresses to test:
[EMAIL]
[EMAIL]
invalid.email@
[EMAIL]
[EMAIL]
notanemail.com
[EMAIL]
π Common Patterns
Email Address
Matches email addresses
/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/gi
Phone Number (US)
Matches US phone numbers
/\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})/g
URL
Matches HTTP/HTTPS URLs
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi
IP Address
Matches IPv4 addresses
/\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b/g
Credit Card
Matches credit card numbers
/\b(?:[0-9]{4}[-\s]?){3}[0-9]{4}\b/g
Hex Color
Matches hex color codes
/#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/gi
Date (MM/DD/YYYY)
Matches MM/DD/YYYY format dates
/\b(0?[1-9]|1[0-2])\/(0?[1-9]|[12][0-9]|3[01])\/(19|20)\d\d\b/g
Word Boundaries
Matches whole word "test"
/\btest\b/gi
π Common Patterns
Character Classes
.
- Any character\d
- Digit (0-9)\w
- Word character\s
- Whitespace[abc]
- Character set[^abc]
- Negated set
Quantifiers
*
- 0 or more+
- 1 or more?
- 0 or 1{n}
- Exactly n{n,m}
- Between n and m{n,}
- n or more
Anchors
^
- Start of string$
- End of string\b
- Word boundary\B
- Non-word boundary
Groups & Flags
(abc)
- Capture group(?:abc)
- Non-captureg
- Global matchi
- Case insensitivem
- Multilines
- Dotall