Remove leading and ending spaces, dots etc

Would you like Bulk Rename Utility to offer new functionality? Post your comments here!

Remove leading and ending spaces, dots etc

Postby abrimaal » Wed Jan 17, 2018 2:08 am

As in the topic title.

Spaces, dots, underscores and other user-defined characters will be removed only when they are at the beginning or the end of filenames.

The operation should be repeated if there are more than one leading/ending spaces.
For user-defined characters to remove, a special type-in form could be provided.
abrimaal
 
Posts: 6
Joined: Wed Jan 17, 2018 1:22 am

Remove leading and/or trailing: Dots/Spaces/Underscores, etc

Postby RegexNinja » Sat Mar 21, 2020 8:11 am

#1Regex provides that functionality.
To remove any combination of leading and trailing: Dots/Spaces/Underscores:

#1Regex Match/Replace
^([. _]*)(.*?)[. _]*$
\2

__ .. __ .. Some_File. Name .. __ ----------> Some_File. Name
............ Some_File..Name ...... ---------> Some_File..Name

Just insert your desired chars into the leading/trailing sets (they dont need to be the same chars).
Cheers
RegexNinja
 
Posts: 134
Joined: Fri Feb 21, 2020 5:26 pm


Return to Suggestions