Add (7) Word Space - Exclude Non-Alphanumeric Characters

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

Add (7) Word Space - Exclude Non-Alphanumeric Characters

Postby spacev2 » Thu Aug 01, 2024 3:19 am

I have entire collections of files and folders that use underscores in their names instead of spaces. As a result of this, I would like to see some additional functionality added to the Add (7) Word Space function.

The Add (7) Word Space function should have a option to exclude spacings for capital letters that reside next to non-alphanumeric characters so that it would output the following file name:

For Example:

ThisFile_NameOnly_Needs_A_Couple_of_CapitalLetter_Spacings


The current Add (7) "Word Space" behaviour will output the following file name:

This File_ Name Only_ Needs_ A_ Couple_ of_ Capital Letter_ Spacings


Whereas the desired file name output that I want is as follows:

This File_Name Only_Needs_A_Couple_of_Capital Letter_Spacings



The next renaming process I perform on the file is to fill in the newly created spaces with a underscore "_" but as a result, we can see that double underscores "__" are also created during the process and I have to perform an additional process of renaming the double underscores "__" back to a single underscore "_". This is the additional process that I want to avoid.

Thanks
spacev2
 
Posts: 51
Joined: Fri Dec 22, 2023 10:58 pm

Re: Add (7) Word Space - Exclude Non-Alphanumeric Characters

Postby Admin » Sat Aug 03, 2024 12:31 am

Hi, thank you for the feedback!
We need to check exactly how word space behaves.... but I think _ can be considered already a space since the underscore sign is mainly used to show a space where a space is not allowed, such as in internet usernames, email addresses and some computer programs.
Admin
Site Admin
 
Posts: 2883
Joined: Tue Mar 08, 2005 8:39 pm

Re: Add (7) Word Space - Exclude Non-Alphanumeric Characters

Postby spacev2 » Sat Aug 03, 2024 4:29 am

Admin wrote:Hi, thank you for the feedback!
We need to check exactly how word space behaves.... but I think _ can be considered already a space since the underscore sign is mainly used to show a space where a space is not allowed, such as in internet usernames, email addresses and some computer programs.


I have found that the current word space behaviour puts a space between not only capital letters but also any capital letters that reside next to any non-alphanumeric character. However this is not mentioned in the BRU documentation as it only states the following:

Quote: "You may also choose to add a "Word Space". This will insert a space before any capital letter (except the first character), unless there's a space already there. So, the name "MyHoliday Photographs" would become "My Holiday Photographs"." End Quote.


However I could also potentially see a use case scenario for having the ability to use word space for capital letters that reside next to non-alphanumeric characters, for example capital letters that are not spaced correctly after full stops. This is why I have suggested to consider implementing a user defined option, however that decision is up to you as a developer.

Thanks
spacev2
 
Posts: 51
Joined: Fri Dec 22, 2023 10:58 pm

Use "_" for word-space function?

Postby Luuk » Sat Aug 03, 2024 5:05 am

For that example, RegEx(1) could use a "v2" Match and Replace like...
(?<!\b)(?<![A-Z_])([A-Z])|[ _]+/g
_$1
Its like word-space but inserts underscores instead, and also replaces any spaces with 1-underscore.
An exception Im giving it, is dont insert anything inbetween 2-or-more uppercase english letters.

If preferring Add(7)'s word-space, then Replace(3) conducting next, could fix it with a "Replace" and "With" like...
\regex\[_ ]+
_

Either way should conduct like...
ThisFile_NameOnly_Needs_A_Couple_of_CapitalLetter_Spacings ---> This_File_Name_Only_Needs_A_Couple_of_Capital_Letter_Spacings
ThisFileNameDoesNeedManyMoreSeparators --------------------------> This_File_Name_Does_Need_Many_More_Separators
This _ Name___ Does __ Have __ Too Many __ __ Separators ------> This_Name_Does_Have_Too_Many_Separators

With RegEx its easy to add exceptions, but most users dont want adding more complicated negative-lookarounds.
So maybe an exceptions-box to accept different chars like ()_[]{}+ so they can be treated like just like letters?
Luuk
 
Posts: 803
Joined: Fri Feb 21, 2020 10:58 pm

Re: Add (7) Word Space - Exclude Non-Alphanumeric Characters

Postby spacev2 » Sat Aug 03, 2024 11:48 pm

I appreciate your reply Luuk,

I will save your suggestions into BRU presets and have a play around with them. However I am definitely not a advanced BRU user and unfortunately I am unable to make any use of the RegEx or Javascript aspect of the BRU application. Even when I refer to the RegEx documentation, I still have difficulty because I simply do not have a coding mindset and I struggle to convert my ideas into that format. So I hope that BRU developers please take this into consideration and understand that there are many novice BRU users like myself who are incapable of taking advantage of RegEx and Javascript.

Thanks
spacev2
 
Posts: 51
Joined: Fri Dec 22, 2023 10:58 pm

Re: Add (7) Word Space - Exclude Non-Alphanumeric Characters

Postby spacev2 » Thu Oct 03, 2024 2:02 am

Hi,

I just wanted to provide some additional information in regards to this suggestion.

Firstly it's important to mention that Windows does not support the following non-alphanumeric characters in file or folder names as it will output the following error: A file name can't contain any of the following characters \ / : * ? " < > |

Example:
Image


The Add (7) Word Space function behaves exactly like this:

(1) A word space is inserted before any capital letter (except the first character)

(2) A word space is inserted before any capital letter (except the first character) that resides next to all non-alphanumeric characters that Windows accepts in file names. ` ~ ! @ # $ % ^ & ( ) - _ = + { } [ ] ; ' , .

Example:
Image


My suggestion is to implement a "Include non-alphanumeric characters" option for the Add (7) Word Space function either into the Add (7) module or in the "Renaming Options" toolbar menu.

Examples of Implementation:

Example 1
Image

Example 2
Image
spacev2
 
Posts: 51
Joined: Fri Dec 22, 2023 10:58 pm

Re: Add (7) Word Space - Exclude Non-Alphanumeric Characters

Postby spacev2 » Thu Oct 03, 2024 5:59 am

Just to clarify my previous post, I would like the "Add (7) Word Space" function to have the ability to do both of the following:

(1) A word space is inserted before any capital letter (except the first character) - (for capital letters that reside next to alphanumeric characters only / excluding capital letters that reside next to non-alphanumeric characters)

(2) A word space is inserted before any capital letter (except the first character) - (for capital letters that reside next to alphanumeric AND non-alphanumeric characters)
spacev2
 
Posts: 51
Joined: Fri Dec 22, 2023 10:58 pm

Re: Add (7) Word Space - Exclude Non-Alphanumeric Characters

Postby Admin » Thu Oct 03, 2024 12:23 pm

Hi, just to clarify, is 1) the current behavior of the word space in BRU and 2) an option you would like to add?
Admin
Site Admin
 
Posts: 2883
Joined: Tue Mar 08, 2005 8:39 pm

Re: Add (7) Word Space - Exclude Non-Alphanumeric Characters

Postby spacev2 » Thu Oct 03, 2024 8:50 pm

The current "Add (7) Word Space" behavior is as follows:

- A word space is inserted before any capital letter (except the first character) AND any capital letter (except the first character) that resides next to all non-alphanumeric characters that Windows accepts in file names. ` ~ ! @ # $ % ^ & ( ) - _ = + { } [ ] ; ' , .


The option that I would like to add is:

- A word space is inserted before any capital letter (except the first character) - for capital letters that reside next to alphanumeric characters only


I come across many situations where I don't want spaces inserted between capital letters that reside beside non-alphanumeric characters.

I hope that made sense.
spacev2
 
Posts: 51
Joined: Fri Dec 22, 2023 10:58 pm

Re: Add (7) Word Space - Exclude Non-Alphanumeric Characters

Postby spacev2 » Sat Apr 19, 2025 11:19 pm

Bumping this thread as i'm still really needing extra functionality for "Add (7) Word Space".


"Add (7) Word Space" Feature Requests:

1. Option to exclude spacings for capital letters that reside next to non-alphanumeric characters. ` ~ ! @ # $ % ^ & ( ) - _ = + { } [ ] ; ' , .

2. Option to exclude spacings for consecutive multiple capital letters


For Example:

Here is a file name where both of these features would be desired. The "Name Segment" function does not suffice in these circumstances.

File Name:

[PREFIX]_FileNameNeedsWordSpacing_01_TNT_Explosive_[SUFFIX]


The desired result with the new options would be:

[PREFIX]_File Name Needs Word Spacing_01_TNT_Explosive_[SUFFIX]


Instead of the current behavior:

[ P R E F I X ]_ File Name Needs Word Spacing_01_ T N T_ Explosive_[ S U F F I X ]
spacev2
 
Posts: 51
Joined: Fri Dec 22, 2023 10:58 pm

Re: Add (7) Word Space - Exclude Non-Alphanumeric Characters

Postby Admin » Tue Apr 22, 2025 8:11 am

Can you use File Segment From _ To _ so that the word space only applies to the FileNameNeedsWordSpacing part?
Admin
Site Admin
 
Posts: 2883
Joined: Tue Mar 08, 2005 8:39 pm

Re: Add (7) Word Space - Exclude Non-Alphanumeric Characters

Postby spacev2 » Tue Apr 22, 2025 3:41 pm

I have tried but the "Name Segment - From & To" but it doesn't always suffice in many different circumstances.

Here are some examples of file names with Capital letters that reside next to non-alphanumeric characters where inserting a space can be un-desirable:

File_Name_01_Description
File_Name_01_[Description]

Here are some examples of file names with consecutive capital letters in a row where inserting a space can be un-desirable:

[PREFIX]_File_Name_01_Description
[PREFIX]_File_Name_01_Description_[SUFFIX]
[PREFIX]_File_Name_01_DESCRIPTION
[PREFIX}_File_Name_01_DESCRIPTION_[SUFFIX]
[PREFIX]_FILE_NAME_01_DESCRIPTION_[SUFFIX]

As you can see there are many different kinds of file name formats where the current "Add (7) Word Space" functionality is un-desirable. Using the "Name Segment - From & To" also doesn't suffice in many different circumstances which makes renaming the files too "Hacky" by using multiple inefficient renaming rules to get the desired result.

So my feature requests for "Add (7) Word Space" are:

1. Implement a "Exclude Alpha-numeric Characters" option where Word Space treats alphanumeric characters ` ~ ! @ # $ % ^ & ( ) - _ = + { } [ ] ; ' , . as normal letters so that a space will not be inserted between capital letters that reside next to a alpha-numeric character.
2. Implement a "Exclude Consecutive Capital Letters" option that will not insert a space between a string of consecutive capital letters, for eg. ABCD will remain as ABCD instead of A B C D
spacev2
 
Posts: 51
Joined: Fri Dec 22, 2023 10:58 pm

Re: Add (7) Word Space - Exclude Non-Alphanumeric Characters

Postby spacev2 » Tue Apr 22, 2025 11:45 pm

Fixing typo mistake.

1. Implement a "Exclude Non Alpha-numeric Characters" option where Word Space treats non-alphanumeric characters ` ~ ! @ # $ % ^ & ( ) - _ = + { } [ ] ; ' , . as normal letters so that a space will not be inserted between capital letters that reside next to a non alpha-numeric character.
spacev2
 
Posts: 51
Joined: Fri Dec 22, 2023 10:58 pm


Return to Suggestions