Make several modifications in one go

A swapping-ground for Regular Expression syntax

Make several modifications in one go

Postby CropperC » Tue Jan 13, 2026 11:27 pm

Hi,

in a folder I always have (almost) the same kind of operations to be performed on all folders:

-swap space for .
-swap _ for .
-swap .-. for .
-change case for FIRST character ONLY
-swap … for .
-swap .. for .
-strip all symbols —> ()[]{}

It it possible to configure the GUI-version in such a way that this can be done in one go (using regex maybe)?

Kind regards, thanks in advance Cropper
CropperC
 
Posts: 4
Joined: Tue Jan 13, 2026 11:13 pm

Re: Make several modifications in one go

Postby Admin » Wed Jan 14, 2026 1:39 am

You can do all of those in one operation using the GUI by combining Replace (3), Remove (5) and Case (4) (and Name Segment) in a single job.
You do not need JavaScript unless you want extra logic. Key points: BRU processes panels left to right in the fixed order shown in the UI, so arrange each transformation into the panel that runs at the correct point (Replace(3) runs before Case(4), Remove(5) runs earlier than Add(7), etc.). Always Preview before Rename and save the criteria to a Favourite (.bru) for reuse.

Recommended step-by-step setup

1) Replace literal sequences (Replace (3))
- Use Replace (3) for simple literal swaps. It supports multiple replacements using | as a separator.
- Example values (click the multiple-replacements editor for convenience):
- Replace: .-.|…|..| |_
- With: .|.|.|.|.
Explanation/order matters: put .-. first so it becomes . before other dot-replacements collapse.

Notes:
- Replace (3) is literal by default (good for these exact characters). If you do need regex here you can prefix the Replace entry with \regex\ (but the /g flag is not supported in that mode).
- You can paste pairs into the Replace editor as columns (tab-separated) for many pairs.

2) Strip the unwanted symbol characters (Remove (5))
- Open Remove (5) panel and either:
- Tick Sym. (removes a broad set of symbols), or
- In Chars (or Words) put the exact characters you want removed, e.g. ()[]{} (or use Chars with the explicit list).
- If you only want to remove those brackets and keep other punctuation, put ()[]{} in Chars (or use Sym. if you want to strip lots of punctuation).

3) Collapse duplicate dots (optional but often helpful)
- If your previous replacements can produce sequences like "...." or "..", you can either:
- Add a second Replace (3) pass mapping .. -> . (include it in the same Replace list, e.g. include ..), or
- Use RegEx(1) with a global regex to collapse repeated dots: Match: \.{2,}/g Replace: . (see below if you prefer regex).

4) Change only the first character case (Case (4) + Name Segment)
- Use Name Segment to restrict changes to the first character:
- Name Segment From: 1 To: 1
- In Case (4) select the casing you want (e.g., Upper to capitalize the first char).
- This will apply the Case change to only character 1.
- After previewing, you can reset Name Segment if you later want full-name case operations.

5) Order & preview
- You generally do not need to change the default panel order for the sequence above because Replace (3) runs before Case (4) and Remove(5) is earlier in the pipeline. But verify in Preview that everything happens in the order you expect.
- Use the Preview button (or select files to see New Name column) to check results on a representative set.

Alternative: Using RegEx(1) (single multi-regex pass)
- If you prefer regex and want everything in one RegEx pass, use RegEx (1) with multiple Match/Replace pairs separated by (?X).
- Example multiple pairs (conceptual):
- Match: \.\-\. (?X) … (?X) \.{2,} (?X) \s (?X) _
- Replace: . (?X) . (?X) . (?X) . (?X) .
- Important: append /g to match patterns where you need global replacement (e.g., \.{2,}/g) — RegEx(1) supports /g and /i.
- RegEx is powerful but a bit more advanced; use the RegEx Assistant (link in the RegEx panel) to test patterns.

Save and reuse
- Once you have the panels configured and preview OK, save the renaming criteria as a Favourite (.bru) so you can run the same job on any folder quickly.

Quick checklist for your exact list
- Replace (3):
- Replace: .-.|…|..| |_
- With: .|.|.|.|.
- Remove (5):
- Chars: ()[]{} OR tick Sym. (if broader symbol removal is desired)
- Name Segment:
- From 1 To 1
- Case (4):
- Mode: Upper (or Lower depending on your need)
Admin
Site Admin
 
Posts: 3136
Joined: Tue Mar 08, 2005 8:39 pm

Re: Make several modifications in one go

Postby Admin » Wed Jan 14, 2026 1:41 am

Or do all with just Regex (1):

1) Single multi-RegEx using the (?X) separator (use this in the RegEx (1) Match and Replace boxes; enable v2 and leave Inc. Ext. OFF if you want to affect only the filename):
- Match (one line):
\s+/g(?X)_+/g(?X)\.\-\.\(?X)…/g(?X)\.{2,}/g(?X)[\(\)\[\]\{\}]+/g(?X)^(.)
- Replace (one line):
.(?X).(?X).(?X).(?X).(?X)(?X)\u$1

Explanation of each step (in order applied):
- \s+/g ? replace 1+ whitespace with .
- _+/g ? replace 1+ underscores with .
- \.\-\.\ -> replace literal .-. with .
- …/g ? replace ellipsis char with .
- \.{2,}/g ? collapse any run of 2+ dots into a single .
- [\(\)\[\]\{\}]+/g ? remove any of ()[]{} (replace with nothing)
- ^(.) ? uppercase the first character only via \u$1

Notes:
- Include the /g flag on the patterns where you need global replacement (done above).
- The final rule (capitalize first char) intentionally does not have /g (it only needs the first match).
- This works on the filename part only (not extension) if Inc. Ext. is unchecked.

2) Comma-separated / CSV-style for the multiple-RegEx editor (one pair per line: Match,Replace). You can paste these lines into the multiple RegEx editor or load from a file (match and replace separated by a comma/tab/pipe):

Lines to paste in the multiple regex editor (each line = Match , Replace):
\s+/g,.
_+/g,.
\.\-\.,.
…/g,.
\.{2,}/g,.
[\(\)\[\]\{\}]+/g,
^(.),\u$1

(Notice the empty replacement for the symbol-removal line — that's correct: it removes the matched characters.)

Practical tips
- Ensure RegEx (1) is set to v2 (Regular Expressions Version 2) so /g and (?X) multi-regex are supported.
- Test on a small subset first and use Preview.
- If you also need to affect extensions, enable Inc. Ext. (but be careful).
- If any filenames already contain multiple transformations (e.g., spaces + underscores), the ordering above will consolidate them to a single dot and then collapse runs of dots — that prevents sequences like ".." being left behind.
Admin
Site Admin
 
Posts: 3136
Joined: Tue Mar 08, 2005 8:39 pm

Re: Make several modifications in one go

Postby CropperC » Wed Jan 14, 2026 10:30 pm

Thanks a lot for your kind and extensive reply, greatly appreciated! I will dive into it over the weekend. For now one question: where to set the second rename pass you mention? Thanks in advance, I’ll report back here. Regards, CropperC
CropperC
 
Posts: 4
Joined: Tue Jan 13, 2026 11:13 pm

Re: Make several modifications in one go

Postby Admin » Thu Jan 15, 2026 12:48 am

Use the RegEx (1) panel (the left-most renaming panel):

- Open RegEx (1) — enter your Match pattern and Replacement in the Match and Replace fields.
- Options in that panel: Inc. Ext. (include extension), Simple (use Simple mode), V2 (use Regex v2).
- V2 supports /i (case-insensitive) and /g (global) modifiers — add them at the end of the Match (e.g. (\w)/gi).

- To run multiple regex operations:
- Enable V2 or Simple mode (only V2 and Simple support multiple expressions).
- Separate Match (and Replace) pairs with the (?X) separator, e.g. Match: (S)(?X)(P) Replace: A(?X)R — this runs two replacements in order.
- Or click the multiple RegEx editor button (the icon next to Match) to open a two-column editor and add many Match/Replace pairs more easily.
Admin
Site Admin
 
Posts: 3136
Joined: Tue Mar 08, 2005 8:39 pm

Re: Make several modifications in one go

Postby CropperC » Thu Jan 15, 2026 3:26 pm

Thanks! Will dive into it soon and report back. Regards, CropperC
CropperC
 
Posts: 4
Joined: Tue Jan 13, 2026 11:13 pm

Re: Make several modifications in one go

Postby CropperC » Wed Jan 21, 2026 8:21 pm

hello Admin, gave it a go and tried the regex you presented. Thanks a lot, it works very well. There are two things that work slightly different over here. I'll post the contents of the .bru that I am creating using your setup. First the .\-\.\ replacement in regex does not work as intended, so I use Replace for that one. Next the setup I am using replaces the first character for a dot (this is not what I intend. I want the first letter if small replaced by a Capital, thereby leaving the rest of the name as is. In case the first character already is a Capital, renaming can be skipped. I use the renamer on folders by the way.

In no way it is understood that I get a response, I would appreciate it though.

Regards! CropperC

[General]
Path=""
[Regular Expressions]
Match="\s+/g(?X)_+/g(?X)\.\-\.\(?X)…/g(?X)\.{2,}/g(?X)[\(\)\[\]\{\}]+/g(?X)^(.)"
Replace=".(?X).(?X).(?X).(?X).(?X)(?X)\u$1"
Include Extension=0
Simple=0
v2=1
[Filename]
Mode=0
Fixed=""
[Replacements]
Replace=".-."
With="."
Match Case=0
First Only=0
[Case]
Change=3
Exceptions=""
[Removals]
First N="0"
Last N="0"
From="0"
To="0"
Chars=""
Words=""
All Digits=0
All Chars=0
All Symbols=0
All High=0
Trim=0
Double Space=1
Accents=0
Crop Mode=0
Crop Marker=""
Lead Dots=0
[MoveCopy]
Source=0
Number="1"
Range="0"
Target=0
Target Pos="1"
Separator=""
[Additions]
Prefix=""
Text=""
Text Pos="0"
Suffix=""
WordSpace=0
[Auto Date]
Mode=0
Type=0
Format=0
Separator=""
Segments=""
Custom=""
Century=0
Offset="0"
[Folder Name]
Mode=0
Separator=""
Levels="1"
[Auto-Number]
Mode=0
Start="1"
Insert="0"
Increment="1"
Pad="0"
Break="0"
Separator=""
Type=8
Case=0
Break Folder=0
[Extension]
Mode=0
Fixed=""
[Selections]
Filter="*"
Filter Match Case=0
Filter Use Regex=0
Files=0
Folders=1
Subfolders=0
Hidden=0
Subfolders Level="0"
Min Name Length="0"
Min Path Length="0"
Max Name Length="0"
Max Path Length="0"
Condition=""
[New Location]
Path=""
Copy Not Move=1
Keep Folder Structure=0
[Name Segment]
From="0"
To="0"
[Criteria]
RegEx=1
File=0
Replace=1
Case=1
Removals=0
MoveCopy=0
Additions=0
AutoDate=0
Folder=0
AutoNumber=0
Extension=0
NameSegment=1
Change Renaming Criteria Order=0
Change Timestamps=0
Change Attributes=0
Javascript Renaming=0
Character Translation=0
[Renaming Criteria Order]
Criteria Order=""
Name Segment Order=0
[Preferences]
Change Created Timestamp=0
Change Modified Timestamp=0
Change Accessed Timestamp=0
Created Timestamp=0
Modified Timestamp=0
Accessed Timestamp=0
Created Timestamp Delta=0
Modified Timestamp Delta=0
Accessed Timestamp Delta=0
Created Timestamp Delta Negative=0
Modified Timestamp Delta Negative=0
Accessed Timestamp Delta Negative=0
Created Timestamp Increment=0
Modified Timestamp Increment=0
Accessed Timestamp Increment=0
DateTaken Change To=0
Change Attributes=0
CropperC
 
Posts: 4
Joined: Tue Jan 13, 2026 11:13 pm

Re: Make several modifications in one go

Postby Luuk » Tue Jan 27, 2026 3:22 am

Its probably just a bad copy and paste. The match should have \.-\.(?X) instead of \.\-\.\(?X).
The \- wont hurt anything, but the trailing \ prevents (?X) from starting the next match.
That would also separate any future Match-and-Replaces from being paired together.

Another way to conduct very similiar, is a "Match" and "Replace" like...
((\.-\.)+|[. _…])+/g(?X)[]\[(){}]+/g(?X)^(.)
.(?X)(?X)\u$1
Luuk
 
Posts: 840
Joined: Fri Feb 21, 2020 10:58 pm


Return to Regular Expressions