Positive Lookbehind(?<=^|[\n;](?:[\t ]*(?:\w+ )?)?) 2nd Alternative[\n;](?:[\t ]*(?:\w+ )?)? \na line-feed (newline) character (ASCII 10)
;the literal ; (5910 / 738 / 3B16)
Non-Capturing Group(?:[\t ]*(?:\w+ )?)? ?repeats the group contents below at most once:
*matches any number of characters from the set below:
\ta tab character (ASCII 9)
the literal (3210 / 408 / 2016)
Non-Capturing Group(?:\w+ )? ?repeats the group contents below at most once:
\w+any word character, repeated at least once
the literal (3210 / 408 / 2016)
exportthe literal text export (case sensitive) \s*any whitespace character, repeated any number of times
Group modifiers(?<modifiers>(?:\s*declare|\s*abstract|\s*async)+)? ?repeats the group contents below at most once:
Non-Capturing Group(?:\s*declare|\s*abstract|\s*async)+ +repeats the group contents below at least once:
1st Alternative\s*declare \s*any whitespace character, repeated any number of times
declarethe literal text declare (case sensitive) 2nd Alternative\s*abstract \s*any whitespace character, repeated any number of times
abstractthe literal text abstract (case sensitive) \s*any whitespace character, repeated any number of times
asyncthe literal text async (case sensitive) \s*any whitespace character, repeated any number of times
Group declaration(?<declaration>class|const +enum|const|enum|function\*?|interface|let|namespace|type(?! *\{)|var) classthe literal text class (case sensitive) 2nd Alternativeconst +enum constthe literal text const (case sensitive) +the literal (3210 / 408 / 2016) , repeated at least once
enumthe literal text enum (case sensitive) constthe literal text const (case sensitive) enumthe literal text enum (case sensitive) 5th Alternativefunction\*? functionthe literal text function (case sensitive) \*?optionally matches the literal * (4210 / 528 / 2A16)
interfacethe literal text interface (case sensitive) letthe literal text let (case sensitive) namespacethe literal text namespace (case sensitive) 9th Alternativetype(?! *\{) typethe literal text type (case sensitive) Negative Lookahead(?! *\{) *the literal (3210 / 408 / 2016) , repeated any number of times
\{the literal { (12310 / 1738 / 7B16)
varthe literal text var (case sensitive) \s+any whitespace character, repeated at least once
Group exports(?<exports>(?:[$_\p{ID_Start}][$\u200C\u200D\p{ID_Continue}]*(?=[\s=:;/({])(?!.*?,))|(?:[\w\t\n\r .,:$'"=-]+)|(?:[{[][\w\t\n\r .,:$'"-]+[}\]])) 1st Alternative(?:[$_\p{ID_Start}][$\u200C\u200D\p{ID_Continue}]*(?=[\s=:;/({])(?!.*?,)) 2nd Alternative(?:[\w\t\n\r .,:$'"=-]+) 3rd Alternative(?:[{[][\w\t\n\r .,:$'"-]+[}\]]) Non-Capturing Group(?:\s*=\s*[$_\p{ID_Start}][$\u200C\u200D\p{ID_Continue}]*)? g modifier: global. Finds all matches instead of stopping after the first
u modifier: unicode. Enables Unicode-aware matching and escape syntax