Problem/Motivation
I have an issue on my Drupal instance whereby the machine names are not loading in properly. They are stopping at the first space, what I found was that the token was failing the validation. The reason for this was that the replace_pattern is used as a salt to generate the hashed token but the javascript was not url encoding the plus sign and therefore it was interpreted as empty space. Giving a mismatch from the token that was generated when the form was built. I have worked on many Drupal projects before and never seen this bug nor could I find any occurrences of anyone else facing it online.
Proposed resolution
Use javascript replace method to ensure that the replace_pattern plus sign is properly encoded.