Remove all spaces


Am I missing something obvious? I want to remove all the spaces from an input. What I have now is a split on spaces and then a repeat to add each element to a variable. Seems kludgy.


A quick regex in Shortcuts perhaps?


Huh. I’ll have to look up what (m?) means, haven’t seen that before, but works a treat, thanks!


That sets the flag for multiline, so that ^ and $ match the start and end of a line instead of the start and end of the whole string. In this case it isn’t needed :wink:

I use for all regex stuff and note that Shortcuts uses the ICU flavor of regular expressions