"Preserve words with mid-word caps" option for Case group

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

"Preserve words with mid-word caps" option for Case group

Postby sbrasel12 » Sat Jan 31, 2026 4:46 pm

I suggest adding this checkbox option to the Case group, obeyed for Title, Title Enhanced and Sentence actions:
/_/ Preserve words with mid-word caps

So that for the filename
... when the FBI agent used an iPhone and PowerPoint
a Case/Title-Enhanced rename results in
... When the FBI Agent Used an iPhone and PowerPoint
instead of the current result
... When the Fbi Agent Used an Iphone and Powerpoint

("mid-word" here refers to any character position other than the leading position)
sbrasel12
 
Posts: 13
Joined: Sat Oct 14, 2023 2:03 am

Re: "Preserve words with mid-word caps" option for Case group

Postby sbrasel12 » Sun Feb 01, 2026 11:19 pm

Perhaps better:
/_/ Preserve words with non-alphabetic characters or mid-word caps
sbrasel12
 
Posts: 13
Joined: Sat Oct 14, 2023 2:03 am

Re: "Preserve words with mid-word caps" option for Case group

Postby Admin » Mon Feb 02, 2026 2:52 am

Thanks — good idea.

Suggested checkbox behavior (what to add to Case ? Title / Title Enhanced / Sentence)
- Checkbox label: Preserve words with mid-word caps (or Preserve words with mid-word capitals/non-alpha)
- Semantics: When checked, the Case operation should skip (leave unchanged) any word that meets either condition:
1. The word contains an uppercase letter at any position other than the first character (i.e., /[A-Z]/ in word.slice(1)), OR
2. The word contains any non-alphabetic character (digits, punctuation) anywhere (i.e., /[^A-Za-z]/).
- Interaction:
- Applies only to Title, Title Enhanced and Sentence modes.
- Skipped words are not modified at all (no lowercasing, no Title Enhanced exceptions).
- Words that do not meet the test are treated normally by the chosen case mode (including Title Enhanced rules/exceptions).
- Rationale / examples:
- "iPhone" ? preserved (mid-word cap). "FBI" ? preserved (all caps contains mid-word cap by rule 1 or could be treated with <ic>).
- "PowerPoint" preserved; normal words like "agent" -> "Agent".

Workaround you can use now (JavaScript renaming)
If you want this behavior immediately you can use the integrated JavaScript renamer. Paste this script into the JavaScript Renaming dialog (Special ? Javascript) and run it. It Title-cases words but preserves words having internal uppercase letters or any non-alpha characters:

Code: Select all
// Preserve mid-word caps or non-alpha while Title-casing other words
(function(){
  // work on the base name (no extension)
  var s = name;
  // split but keep separators (spaces, tabs). Adjust separator regex if you want to include punctuation as separators.
  var parts = s.split(/(\s+)/);
  for (var i = 0; i < parts.length; ++i) {
    var w = parts[i];
    // only transform real words (skip whitespace)
    if (!w || /^\s+$/.test(w)) continue;
    // if word contains any non-alpha or contains Uppercase beyond first char -> preserve
    var hasNonAlpha = /[^A-Za-z]/.test(w);
    var hasMidCap = /[A-Z]/.test(w.slice(1));
    if (hasNonAlpha || hasMidCap) {
      // leave as-is
      continue;
    }
    // else Title-case the word (first char upper, rest lower)
    parts[i] = w.charAt(0).toUpperCase() + w.slice(1).toLowerCase();
  }
  newName = parts.join("");
})();
Admin
Site Admin
 
Posts: 3141
Joined: Tue Mar 08, 2005 8:39 pm


Return to Suggestions


cron