#1 2024-10-02 11:11

Carlos_1959
Member
Registered: 2022-01-08
Posts: 8

Space out CamelCase words

Hello,
I need your help with the following:
I have several files where the file name is in this text example ‘aaaabbbbcccc’ and I want to rename them to ‘aaaa bbbb, cccc’.
What kind of rule can I make?

EDIT:

For example, convert "BeachPiriapolisUruguay.jpg" to "Beach Piriapolis, Uruguay.jpg".

Last edited by den4b (2024-10-04 10:28)

Offline

#2 2024-10-03 14:06

eR@SeR
Senior Member
From: Земун, Србија
Registered: 2008-01-23
Posts: 354

Re: Space out CamelCase words

Hello,

Try RegEx rule:

1) Regular Expressions: Replace expression "^((.)\2+)((.)\4+)((.)\6+)$" with "$1 $3, $5" (skip extension)

From:

aaaabbbbcccc
aabbcc

abc
aabbc
aabcc
abbcc
aaaabbbbccccdddd

To:

aaaa bbbb, cccc
aa bb, cc

abc
aabbc
aabcc
abbcc
aaaabbbbccccdddd


- it is applied only for 3 repeated groups of characters as per given example
- filenames with non repeated characters of 3 groups should be ignored

Please provide feedback if it works as expected.

P.S. Please write more descriptive topic name next time.


TRUTH, FREEDOM, JUSTICE and FATHERLAND are the highest morale values which human is born, lives and dies for!

Offline

#3 2024-10-03 16:44

Carlos_1959
Member
Registered: 2022-01-08
Posts: 8

Re: Space out CamelCase words

Hello,
Didn´t work or I don´t know how to do.
This is the file name and what I want.
Can you try for me?

BeachPiriapolisUruguay.jpg to Beach Piriapolis, Uruguay.jpg

Thank you

Last edited by Carlos_1959 (2024-10-03 16:44)

Offline

#4 2024-10-04 04:59

blackvoid
Member
Registered: 2024-08-04
Posts: 2

Re: Space out CamelCase words

Hard to work out what you want from the first post.
From your example filename, this should work as long as there are three words and they start with a capital letter.


Add rule, choose 'Regular Expressions'.

Add the following :

Expression : ^([A-Z][^A-Z]*)([A-Z][^A-Z]*)([A-Z][^A-Z]*)$
Replace : $1 $2, $3
Case-sensitive : make sure its ticked.
Skip extension : make sure its ticked.

Save rule.

Offline

#5 2024-10-04 10:27

Carlos_1959
Member
Registered: 2022-01-08
Posts: 8

Re: Space out CamelCase words

It worked. Thank you
And I apologise for not explaining correctly what I wanted in my first post.

Offline

#6 2024-10-04 10:36

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Space out CamelCase words

It's worth noting that there is a built-in option in the Clean Up rule to "Insert a space in front of capitalized letters (e.g. CamelCase)".

This option will add spaces between words, but it won't insert a comma after the 2nd word, so it's not a complete solution.

Offline

#7 2024-10-04 19:02

Carlos_1959
Member
Registered: 2022-01-08
Posts: 8

Re: Space out CamelCase words

den4b wrote:

It's worth noting that there is a built-in option in the Clean Up rule to "Insert a space in front of capitalized letters (e.g. CamelCase)".

This option will add spaces between words, but it won't insert a comma after the 2nd word, so it's not a complete solution.


Thank you

Offline

Board footer

Powered by FluxBB