← Về trang chủ

Regex Tester Online — Live Match Highlight + Cheatsheet

Test regex pattern realtime với highlight matches + capture groups. 7 common patterns built-in (email, URL, phone VN, IPv4, hex, UUID, date). Replace mode bonus.

LiveGroupsReplaceCheatsheet
Matches: 6
Order #1234, total: $56.78, tax: $5.43, discount: 10%.
[1] @7: 1234
[2] @21: 56
[3] @24: 78
[4] @34: 5
[5] @36: 43
[6] @50: 10
📚 Common patterns

Vì sao dùng tool này

🎯
Live highlight

Mỗi keystroke trong pattern → matches re-highlight ngay. Visual feedback nhanh.

📚
VN-specific patterns

Cheatsheet có pattern VN phone (+84/0xxxxx) — không phải tool nào cũng có.

🔁
Replace mode

Test pattern + replacement string → preview output. Hỗ trợ $1, $2 capture groups.

Cách sử dụng

  1. 1Nhập pattern (không cần / /) + flags (g/i/m/s).
  2. 2Paste test string vào textarea.
  3. 3Matches highlight tự động. Click vào cheatsheet để load common patterns.

Regex tester

RegExp native JavaScript hỗ trợ ECMAScript spec — gần giống Python/PCRE nhưng có khác biệt nhỏ (vd lookbehind support phụ thuộc browser).

Tool dùng RegExp.exec / String.matchAll cho global flag, hiển thị từng match với index + capture groups.

  • Live realtime match highlight
  • Capture groups display ($1, $2...)
  • 6 flags toggle (g/i/m/s/u/y)
  • Replace mode với preview
  • 7 common patterns cheatsheet
  • VN-specific (phone +84)
  • 100% native RegExp

Câu hỏi thường gặp

Khác regex101.com?

regex101 có explain pattern + multi-flavor (PCRE/Python/JS). Tool này simpler, fast load, VN patterns. Dùng cho daily test.

Lookbehind có support không?

Có, Chrome 62+ / Safari 16.4+. Firefox cần version mới. Pattern '(?<=...)X' và '(?<!...)X' đều OK.

Pattern slow / hangs?

Possible catastrophic backtracking — pattern như (a+)+ trên long input. Browser sẽ throw timeout. Tránh nested quantifiers.