I have a string: "${styles.button} ${styles[color]} ${styles[size]} ${styles[_state]} ${iconOnly ? styles.iconOnly : ''}", and I'm trying to use regex to find all the spaces, except for spaces that are part of an interpolation string (${...}).
I'm willing to admit that regex might not be the right tool for this job, but I'm curious what I'm missing.
Essentially what I'm trying to do is replace the spaces with a newline character.