正则表达式测试器
测试正则表达式并在文本中查找匹配项
正则表达式测试器
测试正则表达式并在文本中查找匹配项
🎯 正则表达式模式
//
Common flags: g (global), i (case-insensitive), m (multiline), s (dotall)
📝 测试文本
📊 匹配
5
找到匹配项
✓
位置
Pattern:
/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/giStatus:
regexTester.validPattern🎯 匹配
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
组:
| # | 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 |
🔄 替换
Use $1, $2, etc. to reference capture groups
Here are some email addresses to test:
[EMAIL]
[EMAIL]
invalid.email@
[EMAIL]
[EMAIL]
notanemail.com
[EMAIL]
🚀 常用模式
Email Address
Matches email addresses
/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/giPhone Number (US)
Matches US phone numbers
/\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})/gURL
Matches HTTP/HTTPS URLs
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/giIP Address
Matches IPv4 addresses
/\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b/gCredit Card
Matches credit card numbers
/\b(?:[0-9]{4}[-\s]?){3}[0-9]{4}\b/gHex Color
Matches hex color codes
/#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/giDate (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/gWord Boundaries
Matches whole word "test"
/\btest\b/gi📚 常用模式
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