INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Tagging help - insert space before Capital letter?  (Read 425 times)

Peter_T

  • Galactic Citizen
  • ****
  • Posts: 356
Tagging help - insert space before Capital letter?
« on: February 26, 2025, 10:18:08 am »

Hi all - I'm sorting out some old photos that have descriptive filenames that I have used to fill in tags, but they are all in the form of:

AlphaBravoRomeo001

And I'd very much like to magically have them reformatted to:
Alpha Bravo Romeo 001

Or even:
Alpha Bravo Romeo001 (i.e. leave numbering out of this if that's easier)

Anyone know how that might be done?
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2831
Re: Tagging help - insert space before Capital letter?
« Reply #1 on: February 26, 2025, 10:33:24 am »

Do all words always start with a Capital letter?
Are you OK that names like "NASATour" would be split like "N A S A Tour" ?
Logged

Peter_T

  • Galactic Citizen
  • ****
  • Posts: 356
Re: Tagging help - insert space before Capital letter?
« Reply #2 on: February 26, 2025, 10:57:14 am »

Good question I hadn't thought of all caps - I did a quick scan and I only see a few place abbreviations here and there so I'd be happy to live with the odd "N A S A" here and there.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2831
Re: Tagging help - insert space before Capital letter?
« Reply #3 on: February 26, 2025, 11:11:58 am »

OK then:
- select a few files
- press F6 to open the Rename tool
- select "Rename" on the first dropdown, de-select all checkboxes EXCEPT "Filename"
- Enter this rule:
Code: [Select]
replace(regex(FileName(,0),/#(\d+|[A-Z][^\dA-Z]*)#/,-2,1),;,/ )- Check the PREVIEW on the right to make sure it's fine, then click OK

If it goes well then you can do more files. Pay attention to files that don't follow your pattern of UppercaseWords001, because this expression will not work well with filenames containing symbols or outside of this pattern.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2831
Re: Tagging help - insert space before Capital letter?
« Reply #4 on: February 26, 2025, 11:16:31 am »

Note that this will change the actual filename on disk - if you just want to change the [Name] field visible on MC, then this is the wrong way.
Logged

Peter_T

  • Galactic Citizen
  • ****
  • Posts: 356
Re: Tagging help - insert space before Capital letter?
« Reply #5 on: February 26, 2025, 12:39:41 pm »

Thanks for the quick response - I was hoping to change the tags only... sorry I should have made that clear.  I tried playing with your regex code in the tagging field, replacing 'filename' with 'Name' or with '[Name]' but no dice. 

I've already renamed my files, I guess I could use the tags to revert them back, then use the code, then rename them to match my new norms for naming... unless this code can be easily changed to work on a tag?
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2831
Re: Tagging help - insert space before Capital letter?
« Reply #6 on: February 26, 2025, 12:54:31 pm »

To fix the [Name], try setting it to:
Code: [Select]
=replace(regex([Name],/#(\d+|[A-Z][^\dA-Z]*)#/,-2,1),;,/ )
You can add this code as a new Expression Column just to test it out. Just right click on any column header and select "Add Expression Column".
Logged

Peter_T

  • Galactic Citizen
  • ****
  • Posts: 356
Re: Tagging help - insert space before Capital letter?
« Reply #7 on: February 26, 2025, 02:21:17 pm »

Brilliant!  Thank you!!
Logged
Pages: [1]   Go Up