mercredi 16 octobre 2019

How to search for "x" or "any number" in a string? [Javascript]

I ran into a bit of a block when wanting to make a dice rolling script.

The idea is that you can input any amount of arguments to roll any amount of dice, 2d6 + 1d4 + 5d2 - [...].

How can I make a script that finds all the xdy's and puts them into an array? It must be based on xdy instead of, for example, spaces for cases like 1d4+1d6-1d8.




Aucun commentaire:

Enregistrer un commentaire