#1 2012-06-21 15:57

April
Member
Registered: 2012-06-14
Posts: 5

Putting a space before a capital letter

Hello again!

You were all so nice & helpful last time, I decided to bug you again smile

A common problem I'm running into is files with names like this:

"EdwinArlingtonRobinson-Merlin"

Is there a way to insert a space before each capital letter?  I've been doing them manually, and it takes FOREVER.

Thanks so much -  you guys are awesome smile

Offline

#2 2012-06-21 19:50

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Putting a space before a capital letter

Hi April, we have thought about such your issue already beforehand,

FROM:
EdwinArlingtonRobinson-Merlin
TO:
Edwin Arlington Robinson-Merlin

please take an look at >> http://www.den4b.com/wiki/ReNamer:Rules:CleanUp


- - -

For your special case "Robinson-Merlin" you can use an additional RegEx Rule:

FROM:
EdwinArlingtonRobinson-Merlin
TO:
Edwin Arlington Robinson - Merlin

1) CleanUp: Insert space in front of capitals, Fix spaces (skip extension)
2) RegEx: Replace expression "([a-z])-([A-Z])" with "$1 - $2" (case-sensitive) (skip extension)


####
I guess i should not take you that exactly with
"Is there a way to insert a space before each capital letter?"
but not before an hyphen ? ;-) 

If  surely, use:
1) CleanUp: Insert space in front of capitals, Fix spaces (skip extension)
2) RegEx: Replace expression "([a-z])-([A-Z])" with "$1- $2" (case-sensitive) (skip extension)

to get "Edwin Arlington Robinson- Merlin" in real.
####





BTW: Instead of one CleanUp plus one RegEx Rule you can also use two RegEx Rules like:
1) RegEx: Replace expression "([a-z])([A-Z])" with "$1 $2" (case-sensitive) (skip extension)
2) RegEx: Replace expression "([a-z])-([A-Z])" with "$1 - $2" (case-sensitive) (skip extension)



HTH? big_smile
.

(Thanks to Denis for the "Export rules to clipboard" feature!)


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#3 2012-06-21 19:53

April
Member
Registered: 2012-06-14
Posts: 5

Re: Putting a space before a capital letter

Stefan,

Will you marry me?

(Just kidding, but thanks again!)

April

Offline

#4 2015-09-29 16:05

lanceru
Member
Registered: 2015-09-29
Posts: 10

Re: Putting a space before a capital letter

Stefan your method worked flawslessly.
I used the following rule to insert a hypen before every Capitalized word except the first.

([a-z])([A-Z])
$1_$2
Checkbox: Skip extension, Case sensitive

I have 3questions though.

What if I only want to add a hyphen, before only the 2nd capitalized word?
Or,
At only the 3rd capitalized word?
Or,
For the 2nd and 3rd capitalized words (specify range)?

I have a file named:
JimCanson_DepartmentManufacture,

and then transform it to:
Jim_Canson_DepartmentManfacture, not Jim_Canson_Department_Manufacture

Last edited by lanceru (2015-09-29 19:15)

Offline

#5 2015-10-05 19:33

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

Re: Putting a space before a capital letter

WARNING: DO NOT POST YOUR QUESTIONS IN TOPICS THAT ARE YEARS OLD! START A NEW THREAD!

Your question has been answered in a different thread.

Offline

Board footer

Powered by FluxBB