Chuyển tới nội dung chính
kitlocal.dev

Bảng tra cứu nhanh Regex

Chạy cục bộ

Xử lý 100% ngay trong trình duyệt. Dữ liệu đầu vào và kết quả không rời khỏi thiết bị.

Cú pháp biểu thức chính quy và mẫu dùng ngay kèm phòng thực hành chạy trực tiếp: neo vị trí, lớp ký tự, định lượng, lookaround và cờ (ES2024).

Cách hoạt động

A regex engine scans left-to-right trying to satisfy your pattern at each position. Quantifiers (*, +, {n,m}) are greedy by default (consuming as much as possible before backtracking); append `?` to make them lazy, and anchor with `^`/`$` or `\b` when you need exact boundaries.

Bộ lệnh sống còn

Vài lệnh nên học trước tiên.

41 lệnh

Phím tắt/Tìm kiếmJKDi chuyển mục chọnCSao chép lệnh đang chọnFĐánh dấu mục đang chọnEscXoá tìm kiếm

Characters & character classes

Match single characters by category (`\d`, `\w`, `\s`) or explicit sets (`[a-f0-9]`). Uppercase shorthands invert the match.

Tài liệu chính thức: Character classes
  • Cơ bản

    Match a digit, word character ([A-Za-z0-9_]) or whitespace.

    \d  \w  \s

    Khi nào dùng

    Core shorthand character classes used in almost every pattern.

    Giải thích từng phần

    \d
    ASCII digit [0-9] (uppercase \D = non-digit)
    \w
    alphanumeric + underscore (uppercase \W = non-word)
    \s
    space, tab or newline (uppercase \S = non-whitespace)

    Ví dụ

    Matches dates inside `"release 2026-11-15"`.

    \d{4}-\d{2}-\d{2}

    Kết quả

    ["2026-11-15"]

    Xem thêm

Anchors & boundaries

Anchors match positions (start/end of string, line or word) rather than consuming characters.

Tài liệu chính thức: Assertions

Quantifiers & laziness

Control how many times the preceding token repeats. Add `?` after any quantifier to match as few times as possible.

Tài liệu chính thức: Quantifiers

Groups, alternation & backreferences

Parentheses group sub-expressions for quantifiers/alternation and capture text for extraction or backreferences.

Tài liệu chính thức: Groups and backreferences

Lookaheads, lookbehinds & flags

Check what appears ahead or behind the current position without making it part of the matched text.

Tài liệu chính thức: Assertions & flags

Dùng thử trong công cụ KitLocal

Thuật ngữ
Greedy vs Lazy
`.*` grabs to the last possible match; `.*?` stops at the earliest match.
Lookaround
Zero-width assertion (`(?=...)`, `(?!...)`, `(?<=...)`) that checks surrounding text without consuming characters.
Backtracking
When a quantifier gives up matched characters so later tokens can match; nested `*`/`+` can cause ReDoS.
Zero-width
Tokens like `^`, `$`, `\b` and lookarounds that match a position rather than characters.

Kiểm tra ngày 15 thg 11, 2026 · Đối chiếu với ES2024 RegExp

Nguồn: MDN Regular Expressions Guide · MDN RegExp Reference

Hãy thay phần trong dấu ngoặc nhọn bằng giá trị của bạn. Lệnh lấy từ tài liệu chính thức, ví dụ đã được chạy thử trên phiên bản được ghi.