How to replace ' @@ , & with an underscore

Bulk Rename Utility How-To's

How to replace ' @@ , & with an underscore

Postby gregstah » Sun Nov 07, 2021 7:01 pm

I'm hoping someone can help I'd like to remove the following characters from filenames and directories and replace with an underscore

' @@ , &

I've tried for some time now but have to admit, I find regex extremely confusing.

Using regexr.com I was able to do it as follows:

/@@|,|\s|'/g

I don't know how to implement this in BRU (yes that whitespace is intended.)

Thank you so much :-) spent hours on this without much joy.

Greg
gregstah
 
Posts: 1
Joined: Sun Nov 07, 2021 6:32 pm

Re: How to replace ' @@ , & with an underscore

Postby Luuk » Mon Nov 08, 2021 4:44 am

First to put a checkmark inside for "v2", so then the "Match" depends on...

To replace each exact character string ' @@ , &
' @@ , &/g

To replace one, or more repeats of the exact character string... ' @@ , &
(' @@ , &)+/g

To replace each one of the characters '@ ,&
['@ ,&]/g

To replace 1-or-more of the characters '@ ,&
['@ ,&]+/g
Luuk
 
Posts: 690
Joined: Fri Feb 21, 2020 10:58 pm

Re: How to replace ' @@ , & with an underscore

Postby therube » Mon Nov 08, 2021 5:44 pm

(Another method.)

3:Replace allows multiple replacement sets (by inserting an "OR", the | symbol), between sets.

Code: Select all
Match:  '|@@|,|&
Replace:  _|_|_|_

Code: Select all
this'XXX is@@a test,this is only&a test.TXT
->   this_XXX is_a test_this is only_a test.TXT
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm


Return to How-To