Skip to content

Commit eb54e59

Browse files
committed
Update README for match
1 parent 0af0a87 commit eb54e59

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,25 @@ This is equivalent to:
406406
const coordinates = oneOrMore.digit.exactly`,`.oneOrMore.digit;
407407
```
408408

409+
`match` can also accept multiple tokens and chain them together, which can be useful for code formatting.
410+
411+
Example:
412+
413+
```js
414+
const filename = match(
415+
oneOrMore.word,
416+
exactly`_`,
417+
oneOrMore.digit,
418+
exactly`.txt`
419+
);
420+
```
421+
422+
This is equivalent to:
423+
424+
```js
425+
const filename = oneOrMore.word.exactly`_`.oneOrMore.digit.exactly`.txt`;
426+
```
427+
409428
#### `toString()`
410429

411430
Get the current expression as a RegExp string. This is a terminal operation, which means no more functions can

0 commit comments

Comments
 (0)