I’m looking to process an address text string and remove the number part of the address,
For example:
‘77-78 smithfield street’ would be turned into ‘smithfield street’.
I know this would likely be a RegEx operation but I’ve no ideas as to how to accomplish it.
Any assistance appreciated.
dbrewood. I’ve included a shortcut solution below. This will work with a single- or multiple-line string. A line that does not match the regex pattern is returned with no change.
Trim Street Numbers.shortcut (22.0 KB)
2 Likes
You are a hero sir!
The multi-line options seems to suit the best. A lot of my testing works, but it fails on a street address of:
93–99 Victoria Street
Any ideas why?
dbrewood. I’m glad that works with the one exception. The separator has to be a dash, and that’s why the Virginia Street address doesn’t work. I can add a separate regex to handle that if you want.
If you could look at that it’d be appreciated, That’ll take me close to what I want to achieve 
The following should do what you want.
Trim Street Numbers.shortcut (22.1 KB)
BTW, the regex in the following shortcut simply looks for the last digit in each line of the string that is followed by a space and returns everything after that point. If for some reason the above shortcut doesn’t work, you might try the following. It’s hard to anticipate all the variations in a street address.
Trim Street Numbers.shortcut (22.0 KB)
Once more, my thanks! I’ve now put the first regex, in place and I’ll see how it works!
A Better Finder Rename will do this for you. So will the “rename” Terminal command which you can install with Homebrew.
If that was installed could it be used within a Shortcut though? And if so what would the syntax be?