Comments in regex

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

Comments in regex

Postby bigi » Mon Feb 02, 2026 3:14 am

I've got quite a lot of complex regex filters in my current config, and to ease find the right ones as i go through issues, I have started making lines containing -----zzzzz <comment> but this is causing issues if i specify any special characters in the explanation!

the reason it's a bit of a nightmare is i have about 85 current regex filters, and about 20 of them handle dates, years, and number ranges - so having to work out what each look ahead/behind/up/down(!) regex is doing takes an age.

To ease my aching brain cell, is it possible to add a separate comments field - or even some way to signify a special comment line that the regex engine completely ignores?
bigi
 
Posts: 35
Joined: Fri Nov 22, 2024 12:10 am

Re: Comments in regex

Postby Admin » Wed Feb 04, 2026 7:05 am

Hi, the multiple regex editor does not support comments, however comments could be supported when loading the multiple regex list from a file.
Another option is to have the Match in RegEx(1) being able to point directly to a text file of multiple regular expressions and that file could support comments (= ignore // , like in JavaScript).
Admin
Site Admin
 
Posts: 3150
Joined: Tue Mar 08, 2005 8:39 pm

Re: Comments in regex

Postby bigi » Wed Feb 11, 2026 2:51 am

either option would be brilliant - it just gets a very painful job when i'm trying to remember what each regex does lol :)
bigi
 
Posts: 35
Joined: Fri Nov 22, 2024 12:10 am

Re: Comments in regex

Postby huntercollins92 » Thu Mar 05, 2026 4:21 am

Loading the regex rules from an external text file with comment support would definitely make long term maintenance easier, especially with that many patterns. Even a simple convention like ignoring lines starting with a specific character could solve most of the readability issues.
huntercollins92
 
Posts: 2
Joined: Thu Mar 05, 2026 4:18 am

Re: Comments in regex

Postby Admin » Fri Mar 06, 2026 9:56 am

It could be a file supporting the // comment marker like Javascript and other language

Add support for loading multiple regex replacement rules from a text file, where blank lines are ignored and lines starting with // (after optional leading whitespace) are treated as comments. This would let users maintain large rule sets more easily, organize them into sections, and document complex expressions without changing the existing multiple regex editor UI. Error messages should ideally report the line number of any invalid rule.

Example

// Date cleanup
s/(\d{4})-(\d{2})-(\d{2})/$3-$2-$1/

// Remove duplicate spaces
s/\s{2,}/ /g

// Strip trailing dash
s/\s*-\s*$//
Admin
Site Admin
 
Posts: 3150
Joined: Tue Mar 08, 2005 8:39 pm

Re: Comments in regex

Postby bigi » Fri Mar 06, 2026 10:12 am

If that could be implemented that would be great
bigi
 
Posts: 35
Joined: Fri Nov 22, 2024 12:10 am


Return to Suggestions