You may have regex probably:
/[\s:-]/g
Usage example:
"YYY-MM-DD HH:MM:SS".replace(/[\s:-]/g, '');
[] blocks any of the contained characters.
In it, I added a \s pattern that matches space characters, such as a space , and the \t tab (not sure if you need bookmarks and new lines, so I went with tabs and skipped the translation lines).
It seems you have already guessed that you want a g lobal match, which allows the regular expression to continue to replace found matches.
source share