From dc60256238af3bcc28d7ffeb1bbe90f36b659dd6 Mon Sep 17 00:00:00 2001 From: Alex Jarvis Date: Fri, 6 Sep 2024 22:50:03 -0400 Subject: [PATCH] Fix Replace Bug (4.6.1) (#620) --- package.json | 2 +- src/matchPattern.ts | 2 +- tests/parseRollArguments.test.ts | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 4de5fef1..8cae3edd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "randsum", - "version": "4.6.0", + "version": "4.6.1", "private": false, "author": "Alex Jarvis", "icon": "https://raw.githubusercontent.com/RANDSUM/randsum-ts/main/icon.webp", diff --git a/src/matchPattern.ts b/src/matchPattern.ts index 3e7b1be7..d9f06eee 100644 --- a/src/matchPattern.ts +++ b/src/matchPattern.ts @@ -5,7 +5,7 @@ export const dropConstraintsPattern = /[Dd]{([<>]?\d+,)*([<>]?\d+)}/g export const explodePattern = /!/g export const uniquePattern = /[Uu]({(\d+,)*(\d+)})?/g export const replacePattern = /[Vv]{([<>]?\d+=?\d+,)*([<>]?\d+=?\d+)}/g -export const rerollPattern = /[Rr]{([<>]?\d,)*([<>]?\d)}\d*/g +export const rerollPattern = /[Rr]{([<>]?\d+,)*([<>]?\d+)}\d*/g export const capPattern = /[Cc]{([<>]?\d+,)*([<>]?\d+)}/g export const plusPattern = /\+\d+/g export const minusPattern = /-\d+/g diff --git a/tests/parseRollArguments.test.ts b/tests/parseRollArguments.test.ts index 19ae7240..0a28b17e 100644 --- a/tests/parseRollArguments.test.ts +++ b/tests/parseRollArguments.test.ts @@ -419,7 +419,7 @@ describe('parseRollArguments', () => { }) describe('given a notation that contains a reroll modifier', () => { - const argument: DiceNotation = `${coreTestString}R{5,<6,>2}3` + const argument: DiceNotation = `${coreTestString}R{5,20,<6,>2}3` test('returns a RollParameter matching the notation', () => { const params = parseRollArguments(argument) @@ -431,7 +431,7 @@ describe('parseRollArguments', () => { ...coreRollParameters, modifiers: { reroll: { - exact: [5], + exact: [5, 20], lessThan: 6, greaterThan: 2, maxReroll: 3 @@ -439,10 +439,10 @@ describe('parseRollArguments', () => { } }, die: new StandardDie(coreRollParameters.sides), - notation: '4d6R{5,>2,<6}3', + notation: '4d6R{5,20,>2,<6}3', description: [ 'Roll 4 6-sided dice', - 'Reroll [5], greater than [2] and less than [6] (up to 3 times)' + 'Reroll [5] and [20], greater than [2] and less than [6] (up to 3 times)' ] }) })