Remove all spaces


#1

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.


#2

A quick regex in Shortcuts perhaps?


#3

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


#4

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 regex101.com for all regex stuff and note that Shortcuts uses the ICU flavor of regular expressions