Skip to content

Commit 94ea0e7

Browse files
committed
changed names in example
1 parent afd0d7f commit 94ea0e7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ As direct dependency: `npm i typed-regexp`
77
```ts
88
import { TypedRegExp } from "typed-regexp";
99

10-
const regexp = new TypedRegExp<[`{${string}`],{group:"a"|"b"}>("(?<group>[ab])({.*)");
10+
const regexp = new TypedRegExp<[`{${string}`],{name:"a"|"b"}>("(?<name>[ab])({.*)");
1111
const match = "string to match".match(regexp);
1212
if (match) {
13-
const namedGroup = match.groups.group;
13+
const namedGroup = match.groups.name;
1414
// => "a"|"b"
1515
const group = match[1];
1616
// => `{${string}`
@@ -21,10 +21,10 @@ or as dev dependency: `npm i -D typed-regexp`
2121
```ts
2222
import type { TypedRegExp } from "typed-regexp";
2323

24-
const regexp = /(?<group>[ab])({.*)/ as TypedRegExp<[`{${string}`],{group:"a"|"b"}>;
24+
const regexp = /(?<name>[ab])({.*)/ as TypedRegExp<[`{${name}`],{group:"a"|"b"}>;
2525
const match = "string to match".match(regexp);
2626
if (match) {
27-
const namedGroup = match.groups.group;
27+
const namedGroup = match.groups.name;
2828
// => "a"|"b"
2929
const group = match[1];
3030
// => `{${string}`

0 commit comments

Comments
 (0)