Permalink
Browse files

do not pretend that roll("1d8+1d12") works

  • Loading branch information...
1 parent 3fee222 commit c4bd871cbc937ef4762634c3974df807ec58066f @rjbs committed Nov 28, 2012
Showing with 6 additions and 0 deletions.
  1. +4 −0 Changes
  2. +2 −0 lib/Games/Dice.pm
View
@@ -1,5 +1,9 @@
Revision history for Perl extension Games-Dice
+{{$NEXT}}
+ - anchor the dice-parsing regex to stop treating roll("1d8+1d12") as
+ roll("1d8+2")
+
0.02 2002-02-20
- Added licence
View
@@ -31,6 +31,8 @@ sub roll ($) {
([-+xX*/bB]) # a + - * / b(est) in $2
(\d+) # an offset in $3
)? # both of those last are optional
+ \s* # possibly some trailing space (like \n)
+ $
}x; # whitespace allowed
$dice_string = $1;

0 comments on commit c4bd871

Please sign in to comment.