how to remove specific characters

Post any Bulk Rename Utility support requirements here. Open to all registered users.

how to remove specific characters

Postby mgroen » Wed Sep 04, 2024 10:38 am

I am new to BRU.

Pretty simple question I guess:

I need BRU to remove all characters between brackets () including the brackets itself and following spaces:

example:
(33) - filename1.text
(sim)- filename2.txt

should result in:

filename1.text
filename2.txt

please help on how to achieve this.

thanks,
mgroen
 
Posts: 7
Joined: Sat Feb 01, 2020 6:14 pm

Re: how to remove specific characters

Postby richardepps » Wed Oct 16, 2024 11:21 am

Hello,
To achieve the removal of all characters between brackets (including the brackets and any following spaces) using BRU (Bulk Rename Utility), you can follow these steps:

Steps to Remove Characters Between Brackets in BRU
1. Open Bulk Rename Utility: Launch the application.
2. Select Files: Navigate to the folder containing the files you want to rename. Select the files you wish to modify.
3. Use the "Replace" Feature:
In the "Rename" section, find the "Replace" feature (usually located in the middle of the interface).
Enter the following in the "Text to be Replaced" field:


Code: Select all
\s*\(.*?\)\s*

Leave the "Replace with" field empty, as you want to remove the text.
4. Enable Regular Expressions:
Ensure that the "Regular Expressions" option is checked. This allows BRU to interpret the input as a regex pattern.
5. Preview Changes: Look at the preview pane at the bottom to see how the filenames will look after the changes.
6. Apply Changes: If everything looks correct, click on the "Rename" button to apply the changes.

Explanation of the Regex

    \s*: Matches any whitespace characters (spaces, tabs) before the opening bracket.
    \(: Matches the literal opening bracket.
    .*?: Matches any characters (non-greedy) until the first closing bracket.
    \): Matches the literal closing bracket.
    .\s*: Matches any whitespace characters that may follow the closing bracket.

This regex effectively removes everything between the brackets, including the brackets themselves and any spaces around them.

Example
Given the files:

(33) - filename1.text
(sim) - filename2.txt

After applying the regex, the result will be:

filename1.text
filename2.txt
richardepps
 
Posts: 1
Joined: Wed Oct 16, 2024 11:15 am

Re: how to remove specific characters

Postby mgroen » Wed Oct 16, 2024 11:33 am

thanks
mgroen
 
Posts: 7
Joined: Sat Feb 01, 2020 6:14 pm

Re: how to remove specific characters

Postby Admin » Thu Oct 17, 2024 1:31 am

You can also use the simplified RegEx syntax in RegEx (1):

- Enable the "Simple" checkbox

Match: %1- %2
Replace: %2
Admin
Site Admin
 
Posts: 2923
Joined: Tue Mar 08, 2005 8:39 pm

Re: how to remove specific characters

Postby mgroen » Fri Nov 01, 2024 12:06 pm

First of all:
really appreciate all the feedback, by using regular expressions to solve the issue.

BUT;

could the BRU interface be improved / simplified (?) in a way that normal computer user (without knowledge of regex) could tackle this and similar issues.
I a way that using the GUI a user could "just simply" input the characters, and mark for replacement (deletion):

IN this case:
input field
( any value)
output:
replace with / delete

With all respect. But in my opinion, such basic usage scenario should not require regex expressions (which for most computer users are unknown),

This could/should be implemented in BRU user interface in a more user friendly way.
mgroen
 
Posts: 7
Joined: Sat Feb 01, 2020 6:14 pm

Re: how to remove specific characters

Postby therube » Fri Nov 01, 2024 3:57 pm

3:Replace
Code: Select all
Replace: (*)<sp>-<sp>
With: <nul>

<sp>, is a literal space that you type in
<nul>, you don't enter anything at all in the With: dialog
*, is a wildcard matching anything

So find anything within parens, followed by a space, followed by a dash, followed by a space, & remove it.

Or if you did enter something into With:, then replace it with With:.
By default all instances of (*) are replaced with With:.
If you only want the first instance, checkmark First:.

Note that with above, & with your example,
(sim)- filename2.txt
would fail, because there is no <sp> following the closing ).

Though you could change Replace to:
Code: Select all
Replace:  (*)*-<sp>


Which (Witch, spooky, but I'm a day late) would find a closing paren followed any any or no other characters, followed by -<sp>.
therube
 
Posts: 1429
Joined: Mon Jan 18, 2016 6:23 pm

Re: how to remove specific characters

Postby Admin » Sat Nov 02, 2024 12:46 am

Could also have two replacements:

Replace: (*)<sp>-<sp>
With: <nul>

and

Replace: (*)-<sp>
With: <nul>

OR also

Remove (5)
Crop-> Special -> *-
(this crops everything before - inclusive)
Admin
Site Admin
 
Posts: 2923
Joined: Tue Mar 08, 2005 8:39 pm

Re: how to remove specific characters

Postby mgroen » Sat Nov 02, 2024 6:23 pm

I have no idea how to use it.

Could above usages be made more clear by creating screenshots in BRU and upload them here?

thanks
mgroen
 
Posts: 7
Joined: Sat Feb 01, 2020 6:14 pm


Return to BRU Support