diff --git a/dice_test.go b/dice_test.go index 902b16b..3f8a535 100644 --- a/dice_test.go +++ b/dice_test.go @@ -31,7 +31,6 @@ func TestRollDice(t *testing.T) { {"2d6+e", plannedFailure}, {"2e6?_", plannedFailure}, {"-3d8", plannedFailure}, - {"kd4", plannedError}, {"3d1", plannedError}, {"2d112", plannedError}, {"4d0", plannedError}, diff --git a/utils.go b/utils.go index 62196cb..f8b77a4 100644 --- a/utils.go +++ b/utils.go @@ -27,7 +27,7 @@ var ( wordEndingInBang = regexp.MustCompile(`!["'] |\n+`) wordStartingWithBang = regexp.MustCompile(`\s+! *\S+`) - diceRegex = regexp.MustCompile(`^(?:roll )?\s*(.*?)d(\d+)([+-]\d+)?`) + diceRegex = regexp.MustCompile(`^(?:roll\s+)?(\d*)d(\d+)([+-]\d+)?`) cardMetadataRegex = regexp.MustCompile(`(?i)^(?:rulings?|reminder|flavou?r) `)