You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TS Regex Builder allows you to build complex regular expressions using domain-specific language or regex components.
60
+
61
+
Terminology:
62
+
* regex component (e.g., `capture()`, `oneOrMore()`, `word`) - function or object representing a regex construct
63
+
* regex element (`RegexElement`) - object returned by regex components
64
+
* regex sequence (`RegexSequence`) - single regex element or string (`RegexElement | string`) or array of such elements and strings (`Array<RegexElement | string>`)
65
+
66
+
Most of the regex components accept a regex sequence. Examples of sequences:
67
+
* single string: `'Hello World'` - note all characters will be automatically escaped in the resulting regex
68
+
* single element: `capture('abc')`
69
+
* array of elements and strings: `['$', oneOrMore(digit)]`
70
+
71
+
Regex components can be composed into a complex tree:
|`zeroOrMore(x)`|`x*`|`(seq: RegexSequence) => RegexElement`| Zero or more occurence of a pattern |
108
+
|`oneOrMore(x)`|`x+`|`(seq: RegexSequence) => RegexElement`| One or more occurence of a pattern |
109
+
|`optionally(x)`|`x?`|`(seq: RegexSequence) => RegexElement`| Zero or one occurence of a pattern |
110
+
|`repeat({ count: n }, x)`|`x{n}`|`({ count: number }, seq: RegexSequence) => RegexElement`| Pattern repeats exact number of times |
111
+
|`repeat({ min: n, }, x)`|`x{n,}`|`({ min: number }, seq: RegexSequence) => RegexElement`| Pattern repeats at least given number of times |
112
+
|`repeat({ min: n, max: n2 }, x)`|`x{n1,n2}`|`({ min: number, max: number }, seq: RegexSequence) => RegexElement`| Pattern repeats between n1 and n2 number of times |
0 commit comments