RegExp NFA Motoru & Canlı Eşleşme8 dk okumaGüncelleme tarihi:
Düzenli İfadelerde Uzmanlaşma: JavaScript RegExp Motoru ve Canlı Testler
Düzenli ifadeleri anında test edin, yakalama gruplarını inceleyin ve gerçek zamanlı vurgulama ile değiştirme simülasyonları yapın.
W
WEBioDD Mühendislik Ekibi•%100 Tarayıcı İçi ve Sıfır Güven
Temel Noktalar
- JavaScript, geri izleme ve lookaround destekleyen NFA (Deterministik Olmayan Sonlu Otomat) motoru kullanır.
- Yakalama grupları alt dizeleri ayıklar; yakalamayan gruplar belleği tüketmeden gruplama yapar.
- Lookahead ve lookbehind kontrolleri, karakterleri eşleşmeye dahil etmeden çevre bağlamını doğrular.
- Regex bayrakları (g, i, m gibi) arama davranışını tüm metin genelinde değiştirir.
100% In-Browser & Local Execution
Düzenli İfadeleri Test Edin ve Hataları Ayıklayın
Eşleşme indeksleme, yakalama grupları tablosu ve canlı değiştirme simülatörü ile Regex desenlerini değerlendirin.
- Real-time match highlighting
- Capture groups inspector
- Substitution simulator
- RegExp flags (g, i, m, s, u)
01.How the JavaScript RegExp Engine Works (NFA & Backtracking)
The JavaScript RegExp engine utilizes a Non-deterministic Finite Automaton (NFA). When matching a pattern against a string, the engine tests candidate paths. If a path fails, it backtracks to previous decision states. Understanding backtracking is crucial for avoiding Regular Expression Denial of Service (ReDoS) catastrophic backtracking vulnerabilities.
02.Mastering Capture Groups, Named Groups & Lookarounds
Capture groups allow you to isolate sub-patterns and reference them in string substitutions via $1, $2, etc. Named capture groups (?<name>...) assign semantic keys to matches. Lookahead assertions check if a pattern is followed by another pattern without including it in the match.
How to Test and Debug Regular Expressions
Step-by-step regex testing workflow.
1
Enter Regex Pattern
Type your regular expression into the pattern input field (e.g., [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}).
2
Select Regex Flags
Toggle flags like g (global), i (case-insensitive), or m (multiline).
3
Input Test String
Paste candidate text to view instant highlighted matches.
4
Inspect Capture Groups
Review the capture groups table to examine indexed and named sub-matches.
Frequently Asked Questions
Capturing groups ((...)) save the matched text for later extraction, while non-capturing groups ((?:...)) group expressions without saving memory.