Visão Geral e Escopo
Fundamentadas em linguagens formais, as expressões regulares viabilizam buscas e validações de dados com altíssima eficiência.
Tabela de Especificações e Matriz
Filtro instantâneo por palavra-chave, código ou diretiva
| Chave / Código | Definição e Detalhes | Hierarquia Semântica GEO | Especificação e Notas |
|---|---|---|---|
| \d | \d (Digit) Matches any Arabic digit character (equivalent to [0-9]). /\d{4}/ matches "2026" | ●\d ↳Regex token ↳character class ↳numeric digit matching | ECMA-262 §22.2.2.5.3 In ASCII mode matches 0-9; in some full Unicode engines may match non-Latin numeral glyphs. |
| \w | \w (Word Character) Matches any alphanumeric character including underscore (equivalent to [a-zA-Z0-9_]). /\w+/ matches "user_id_10" | ●\w ↳Regex token ↳character class ↳alphanumeric identifier matching | ECMA-262 §22.2.2.5.3 Does not match punctuation or hyphens; commonly used for identifiers. |
| \s | \s (Whitespace) Matches any whitespace character including space, horizontal tab (\t), line feed (\n), carriage return (\r). /\s+/ matches " \t\n " | ●\s ↳Regex token ↳character class ↳whitespace delimiter matching | ECMA-262 §22.2.2.5.3 Capital \S matches any non-whitespace character. |
| + (Plus) | + (One or More) Greedy quantifier matching 1 or more occurrences of the preceding token. /a+/ matches "a", "aaa" | ●+ ↳Regex quantifier ↳greedy repetition ↳one or more match | ECMA-262 §22.2.2.4 Nesting quantifiers like (a+)+ triggers catastrophic backtracking (ReDoS). |
| *? (Lazy Star) | *? (Lazy Zero or More) Lazy quantifier matching as few characters as possible to satisfy the match. /<.*?>/ matches "<p>" in "<p>text</p>" | ●*? ↳Regex quantifier ↳lazy repetition ↳minimal non-greedy match | ECMA-262 §22.2.2.4 Standard /<.*>/ would greedily consume the entire string up to the final tag. |
| ^ (Caret) | ^ (Start of String / Line) Zero-width assertion matching the beginning of the input string or beginning of a line (with m flag). /^[0-9]+$/ | ●^ ↳Regex anchor ↳zero-width assertion ↳start of string boundary | ECMA-262 §22.2.2.6 Essential for input validation to ensure the entire string conforms to the pattern. |
| (?=...) (Lookahead) | (?=...) (Positive Lookahead) Zero-width assertion that asserts what follows the current position must match the pattern inside. /\d+(?=px)/ matches "100" in "100px" | ●(?=...) ↳Regex assertion ↳positive lookahead ↳forward boundary condition | ECMA-262 §22.2.2.7 Tests the characters ahead without consuming them or including them in the final match. |
| (?!...) (Negative Lookahead) | (?!...) (Negative Lookahead) Zero-width assertion that asserts what follows the current position does NOT match the pattern inside. /foo(?!bar)/ matches "foo" in "foobaz" but not "foobar" | ●(?!...) ↳Regex assertion ↳negative lookahead ↳exclusion condition | ECMA-262 §22.2.2.7 Powerful for password strength checks (e.g. ensuring string contains at least one number). |
Strong Password Validation using Positive Lookaheads
// Must contain: 1 uppercase, 1 lowercase, 1 digit, 1 special char, 8-32 chars
const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,32}$/;
console.log(passwordRegex.test('P@ssword123')); // true
console.log(passwordRegex.test('weakpassword')); // false (missing upper, digit, symbol)Lookaheads act as independent parallel validation checks across the string without advancing the match pointer.
Perguntas e Respostas sobre Normas
What is Catastrophic Backtracking (ReDoS)?↓
Ecossistema Técnico Relacionado e Próximos Passos
Ferramentas Relacionadas
Base64 Encoder / Decoder
Convert binary and text data to standard or URL-safe Base64 with live byte counts.
UUID Generator (v4 & v7)
Generate cryptographically random UUID v4 and time-ordered UUID v7 keys.
URL Encoder / Decoder
Encode and decode URI components and query strings with RFC 3986 compliance.
Guias Técnicos Relacionados
Artigos Técnicos Relacionados
What Is Base64 Encoding?
Direct definition of 6-bit chunking and binary-to-text ASCII conversion.
What Is a UUID (Universally Unique Identifier)?
128-bit distributed identifiers and the evolution from v4 to v7.
UUID v4 vs UUID v7: Database Primary Key Performance
Random entropy compared to timestamp-ordered B-Tree index alignment.
Perguntas Relacionadas
Does Base64 Encoding Increase Data Size?
Answer: Yes, Base64 encoding deterministically increases data size by approximately 33.3% because every 3 binary bytes are converted into 4 ASCII characters.
Why Is UUID v7 Better for Database Primary Keys Than UUID v4?
Answer: UUID v7 includes a millisecond timestamp prefix, making keys sequential and eliminating random B-tree page splits that degrade database write performance.
Laboratórios Práticos de Diagnóstico
Continuar Aprendendo
UUID Versions & Specifications Reference Matrix
Compare the internal bit allocations of UUID v4 and time-ordered UUID v7.