Chuyển tới nội dung chính
Z

What is Regular expression?

A regular expression (regex) is a pattern that describes a set of strings, used to search, match, validate and replace text. Built from literal characters and special metacharacters (like . * + ? [ ] ( )), it is supported by virtually every programming language and text editor.

Regex combines literals with metacharacters: . matches any character, */+/? are quantifiers, [...] is a character class, ( ) groups, and ^/$ anchor to start/end. For example ^\d{3}-\d{4}$ matches a 7-digit phone number.

Regexes power form validation (emails, URLs), search-and-replace, log parsing and tokenizing — but complex patterns can be hard to read, so keep them documented.

Regular expression tools

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

Phiên bản XPath nào được hỗ trợ?

XPath 1.0 — phiên bản được trình duyệt hỗ trợ gốc. Các tính năng của XPath 2.0/3.0 (regex, sequence, kiểu dữ liệu) chưa được hỗ trợ.

Vì sao truy vấn HTML của tôi không trả về kết quả nào?

Chế độ HTML sẽ bọc đoạn mã của bạn trong <code class="font-mono">html/body</code>. Hãy điều chỉnh biểu thức cho phù hợp (ví dụ: <code class="font-mono">//body//div</code>).

Các công cụ liên quan?

<a class="text-brand-600 hover:underline" href="/jsonpath-tester">JSONPath Tester</a> để truy vấn JSON; <a class="text-brand-600 hover:underline" href="/xml-formatter">XML Formatter</a> để làm sạch XML trước.