This gives me the two different parts, but I can't seem to figure out how to do the next part which is split by the character d and then eval() the two parts. So that my final string would look something like 4d8/2d8.

I am aware that you should avoid eval() but that really isn't a concern with this project.

What result are you expecting from this calculation? Within your callback for the .forEach() you could always do another .split() call. Is this limited to one level of this type of input?
– Ken H.Apr 11 '17 at 22:11

I still want to d character, I want the math operation to only happen to the left and right side of the d so that the 2*2 becomes 4. The final string should look like 4d8/2d8. Sorry I am not sure I worded that very well.
– Robert E. McIntoshApr 11 '17 at 22:12