$1, $<name>), and browse a built-in library of common production patterns.The JavaScript ECMAScript RegEx engine utilizes a deterministic finite automaton (DFA) and non-deterministic finite automaton (NFA) backtracking model to match strings against regular expression tokens. Understanding how key tokens interact is crucial for writing efficient patterns:
\d (digits [0-9]), \w (alphanumerics and underscore [A-Za-z0-9_]), and \s (whitespace) match specific token classes.+, *, {min,max}) consume as many characters as possible before backtracking. Adding a lazy modifier (+?, *?) forces the engine to match the minimum necessary characters.^ asserts the start of a string (or line in multiline mode), $ asserts the end, and \b establishes word boundaries.(?=...) and negative lookaheads (?!...), along with positive lookbehinds (?<=...) and negative lookbehinds (?<!...), assert conditions without consuming characters in the match result.Parentheses (...) create capture groups that isolate specific substrings from the overall match. Numbered capture groups are indexed from $1 to $99 based on opening parenthesis order. Modern JavaScript (ES2018+) also supports named capture groups using the (?<name>...) syntax. Named groups enhance code readability by returning structured key-value dictionaries, making parameter extraction from URLs and log lines intuitive and self-documenting.
Regular Expression Denial of Service (ReDoS) occurs when nested quantifiers (e.g. (a+)+$) cause the engine to explore exponential execution paths when presented with non-matching inputs. Our testing environment implements client-side execution timeouts to catch runaway backtracking loops before they can freeze your browser tab.
g), Case-Insensitive (i), Multiline (m), DotAll (s), or Unicode (u).$1, $2, $<name>).Scenario: Extracting valid email addresses from unstructured contact logs.
Pattern: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,} | Flags: giMatches: 'support@antigravity.dev', 'admin@example.org'
Isolates RFC-compliant email address strings.
Scenario: Capturing key-value pairs using named capture groups.
Pattern: (?<key>\w+)=(?<val>[^&]+) | String: 'page=2&sort=desc'
Group 'key': 'page', Group 'val': '2' | Group 'key': 'sort', Group 'val': 'desc'
Extracts structured parameter dictionaries from URL query strings.
Validate and format JSON data containing regex string properties.
Compare regex substitution outputs against expected text results.
Parse and validate cron automation expressions.