Skip to content

Commit

Permalink
Readme tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
slevithan committed Jan 8, 2025
1 parent b5f24e5 commit 21b38a5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ Above, the `{0}` quantifier at the end of the `(?<byte>…)` group allows *defin
This next regex matches a record with multiple date fields, and captures each value:

```js
const record = regex`
const re = regex`
^ Admitted:\ (?<admitted> \g<date>) \n
Released:\ (?<released> \g<date>) $
Expand Down Expand Up @@ -360,9 +360,8 @@ const re = regex`
(?<day> \d{2})
)
`;

const record = 'Admitted: 2024-01-01\nReleased: 2024-01-03';
const match = record.match(re);
const match = re.exec(record);
console.log(match.groups);
/* → {
admitted: '2024-01-01',
Expand Down

0 comments on commit 21b38a5

Please sign in to comment.