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
Copy file name to clipboardExpand all lines: website/docs/api/constructs.md
+35-2Lines changed: 35 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ These functions and objects represent available regex constructs.
9
9
10
10
```ts
11
11
function choiceOf(
12
-
...alternatives:RegexSequence[]
12
+
...alternatives:RegexSequence[],
13
13
):ChoiceOf {
14
14
```
15
15
@@ -22,7 +22,9 @@ Example: `choiceOf("color", "colour")` matches either `color` or `colour` patter
22
22
### `capture()`
23
23
24
24
```ts
25
-
function capture(sequence:RegexSequence):Capture;
25
+
function capture(
26
+
sequence:RegexSequence,
27
+
):Capture;
26
28
```
27
29
28
30
Regex syntax: `(...)`.
@@ -35,3 +37,34 @@ TS Regex Builder does not have a construct for non-capturing groups. Such groups
35
37
36
38
:::
37
39
40
+
### `regex()`
41
+
42
+
```ts
43
+
function regex(
44
+
sequence:RegexSequence,
45
+
):Regex;
46
+
```
47
+
48
+
Regex syntax: the pattern remains unchanged when wrapped by this construct.
49
+
50
+
This construct is a no-op operator that groups array of `RegexElements` into a single element for composition purposes. This is particularly useful for defining smaller sequence patterns as separate variables.
0 commit comments