Title |
Test
Find
Pattern Title
|
Expression |
(?<dice>\d*)(?<dsides>(?<separator>[\d\D])(?<sides>\d+))(?<modifier>(?<sign>[\+\-])(?<addend>\d))? |
Description |
D&D dice:
If no dice are entered, 1 can be assumed.
d or D is required to indicate sides, and cannot exist without a sides digit.
The modifier is optional. However, if there is a modifier, a sign and an addend must be included. |
Matches |
2d6+4 | 2d6 | d6+4 |
Non-Matches |
6- | d | 2d |
Author |
Rating:
Not yet rated.
Janine White
|
Source |
Janine White |
Your Rating |
|
Title: Minor correction
Name: Guillaume JAY
Date: 5/5/2008 3:54:57 PM
Comment:
I changed the end to
(?<addend>\d*))?
(added * after d)
because 14D10+86 is a valid dice expression
Title: Minor correction
Name: Guillaume JAY
Date: 5/5/2008 3:54:42 PM
Comment:
I changed the end to
(?<addend>\d*))?
(added * after d)
because 14D10+86 is a valid dice expression
Title: Edit
Name: Janine White
Date: 7/19/2004 10:39:32 AM
Comment:
Thanks for the suggestion. I have updated the regex.
Title: Suggestion
Name: Bryan Kilian
Date: 7/18/2004 2:47:48 PM
Comment:
Only thing I would suggest is replacing the * at the end with a ? (match 0 or 1 times). Your current regex will match
3d6+1+2+3