Splitting CamelCase into Title Case ??

56 views
Skip to first unread message

Jeremiah Moore

unread,
Apr 24, 2009, 3:25:17 PM4/24/09
to Soundminer Users Collective
hi all -

Anybody have a method for splitting CamelCase into full words?  (i.e.  "AlienSpaceshipTransmuter" becomes "Alien Spaceship Transmuter")

Supposedly it can be done with RegEx.  

I've got a bunch of descriptions here I want to expand, so they're easier to read.


--
-----------------------------------------------------------
jeremiah moore | SOUND | jmo...@northstation.net
http://www.jeremiahmoore.com/
http://babyjane.com/timeweb/


Nathaniel Reichman

unread,
Apr 26, 2009, 2:55:18 PM4/26/09
to soundmi...@googlegroups.com
Have you tried "A Better Finder Rename"?

Good luck,

Nathaniel Reichman

>== 1 of 1 ==
>Date: Fri, Apr 24 2009 12:25 pm
>From: Jeremiah Moore

Jeremiah Moore

unread,
Apr 27, 2009, 4:25:21 AM4/27/09
to soundmi...@googlegroups.com
Ney Nathaniel - ABFR does not seem to do it.  There's a "Title Case" feature, but it does not seem to detect change-of-case as a word delimiter.

I don't know regex at all... but did find this little bit of code.  Maybe it can be coaxed to work w/ SoundMiner's regex feature in Find/Replace...  Anyone?

output = System.Text.RegularExpressions.Regex.Replace(
    input,
    "([A-Z])",
    " $1",
    System.Text.RegularExpressions.RegexOptions.Compiled).Trim();

-jeremiah

stevep

unread,
Apr 27, 2009, 3:17:12 PM4/27/09
to Soundminer Users Collective
Justin would know this for sure. email him direclty as he quite good
with REGEX. Your regex code would not do it I think as the dollar
sing is purely for use at the end of a line feed.

steve

On Apr 27, 4:25 am, Jeremiah Moore <jeremiahmo...@gmail.com> wrote:
> Ney Nathaniel - ABFR does not seem to do it.  There's a "Title Case"
> feature, but it does not seem to detect change-of-case as a word delimiter.
>
> I don't know regex at all... but did find this little bit of code.  Maybe it
> can be coaxed to work w/ SoundMiner's regex feature in Find/Replace...
> Anyone?
>
> output = System.Text.RegularExpressions.Regex.Replace(
>     input,
>     "([A-Z])",
>     " $1",
>     System.Text.RegularExpressions.RegexOptions.Compiled).Trim();
>
> -jeremiah
>

Jeremiah Moore

unread,
Apr 28, 2009, 2:54:06 PM4/28/09
to Soundminer Users Collective
OK, Here's the quick-and-dirty version within SoundMiner 4.8.1 
(note: in subsequent SM versions, the "replace string" may change from "\1" to "$1")

 - select records
 - right-click in field you want to modify, select "find and replace selection"
 - check that "field" is correct, tick the RegEx box
 - Find:  "([A-Z][a-z])"  (don't include quotes.  Finds an uppercase character followed by a lowercase character)
 - Replace " \1"  (that's space, backslash, one)
 - click "preview" and review, then "commit" the "close and save" if it's right.

Now cleanup - if somebody knows how to do this as part of the regex, great.
 - in Admin window, remove leading/trailing spaces
 - remove instances of two or more spaces - do another RegEx find/replace using:
 - Find: "  +"  (that's space space plus)
 - Replace: " "  (that's space)

OK!  Enough geeking for today.  But always happy to be able to make these things work.

-jeremiah
Reply all
Reply to author
Forward
0 new messages