.* 正则测试

编写正则表达式,输入测试文本,实时查看匹配结果与捕获组

📝 REGEX PATTERN
全局
忽略大小写
多行
点全匹配
Unicode
📄 TEST TEXT
🔢 0 chars 🎯 0 matches
📋 MATCH RESULTS
# Range Match Groups
No matches yet
🎨 HIGHLIGHTED TEXT
🔍 REGEX EXPLANATION
输入正则表达式查看逐词解释
📖 Quick Reference
💻 Language Usage

What Are Regular Expressions?

Regular Expressions (regex) are powerful text pattern matching tools widely used in programming. LitekitHub's Regex Tester provides real-time match highlighting, capture group display, token-by-token explanation, and multi-language code examples.

Core Features

  • Real-Time Matching: View all match results (position + content) instantly.
  • Capture Groups: Auto-parse group content, supports named groups.
  • Highlighting: Color-coded match highlighting.
  • Replace Mode: $1/$2 backreference substitution with statistics.
  • Token Explanation: Natural language breakdown of each regex token.
  • Flag Toggles: g/i/m/s/u flags at a click.
  • Presets: 10 built-in common patterns.
  • Quick Reference: 30+ syntax cheat cards.
  • Multi-Language: Auto-generate JS/Python/Java/PHP/Go/C#/Ruby/Rust snippets.

Syntax Quick Reference

Anchors: ^ start, $ end, \b word boundary.

Character Classes: \d digit, \w word, \s whitespace, . any char, [abc] set, [^abc] negated.

Quantifiers: * 0+, + 1+, ? 0-1, {n} exactly n, {n,m} n to m. Append ? for lazy.

Groups: (...) capture, (?:...) non-capture, (?P<name>...) named, \1 backref, | OR.

Assertions: (?=...) positive lookahead, (?!...) negative lookahead, (?<=...) positive lookbehind, (?<!...) negative lookbehind.

Flags: g global, i case-insensitive, m multiline, s dotall, u unicode.

Common Use Cases

Use CasePatternDescription
Email[\w.%+-]+@[\w.-]+\.[A-Za-z]{2,}Standard email
Phone1[3-9]\d{9}China mobile
URLhttps?://[^\s]+HTTP/HTTPS
IPv4(\d{1,3}\.){3}\d{1,3}IPv4 addresses
Date\d{4}-\d{2}-\d{2}YYYY-MM-DD
Hex Color#[0-9A-Fa-f]{6}6-digit color
Chinese[\u4e00-\u9fa5]+Chinese chars
HTML Tag<[^>]+>HTML/XML tags
Password(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}8+ chars with mix

Learning Tips

  1. Start with basic symbols like \d, \w, +, *.
  2. Use the token explanation feature to understand syntax.
  3. Study presets to learn common patterns.
  4. Watch for greedy traps — add ? for lazy mode.

Try regex testing now!