Dice notation roller in JavaScript
You validate the input string against a regular expression, but then you manually parse it again the hard way.  Instead, you should use parentheses within the regular expression to define capturing groups.

I also think that your regular expression is not quite correct.  Optional digits X preceding "d" should be \d* or (\d+)?.  An optional ±Z should be ([+-]\d+)?.

function dieRoll(dieSpec) {
    var match = /^(\d+)?d(\d+)([+-]\d+)?$/.exec(dieSpec);
    if (!match) {
        throw "Invalid dice notation: " + dieSpec;
    }

    var howMany = (typeof match[1] == 'undefined') ? 1 : parseInt(match[1]);
    var dieSize = parseInt(match[2]);
    var modifier = (typeof match[3] == 'undefined') ? 0 : parseInt(match[3]);

    …
}