Sublime Forum

Remove Whitespaces After A Certain Character

#1

I’m looking for a regex for the following scenario. I’m trying to remove all whitespaces after a certain character. I’m trying to rename lots of files in a specific manner. For example:

I have the filename “SYS022-02 Stardust_No Vocals.wav” or “SYS022-06 If You Build It He Will Come_Act 3 No Orchestra Mix.wav

But I’d like them to read “SYS022-02 Stardust_NoVocals.wav” and “SYS022-06 If You Build It He Will Come_Act3NoOrchestraMix.wav

So basically I’d like to eliminate all whitespaces after the underscore “_”. Anybody have a regular expression for this scenario? Been trying for hours. Thanks for any help!

0 Likes

#2

I suggest a two-step solution. You didn’t say what your file layout is like, so I assume there is a filename on each line. If it isn’t, you’ll need to be more specific.

  1. Search for _.*$ and “Find All”
  2. With that selected, Search for \s+ and replace with nothing. Ensure that the “In selection” toggle is set.
0 Likes