Subject: Re: [Name Mangler Talk] Moving parts of a name to another part of the name

From: Rob Griffiths <[email-masked]>
Date: Tue, 2 Oct 2012 14:50:39 -0700

On Oct 2, 2012, at 2:46 PM, Licachat wrote:

> This is actually exactly what I'm needing as someone named their music files song title - artist name.mp3 and I'm needing artist name - song title.mp3
> 
> What is the actual code I need to put into the advanced window to run this?

That would depend, somewhat, on exactly how those names appear. If they're exactly as you say they are, always separated by one hyphen which never appears anywhere else, then the code from the original reply would work. Note that you don't need Advanced mode for this; just Find and Replace, but check the box below the Find entry to mark it as a regular expression.

Find:    (.*)\s-\s(.*)
Replace: $2 - $1

Please test on a copy of your files!

regards,
-rob.

---

From: Dave Nelson <[email-masked]>
Date: Fri, 2 Dec 2011 09:08:30 -0500

Rob, that looks like it does the trick, thanks.

On Fri, Dec 2, 2011 at 1:18 AM, Rob Griffiths <[email-masked]> wrote:

> On Dec 1, 2011, at 7:38 PM, davenelson wrote:
>
> > I have ebooks with names like "book title - author name.mobi" and
> > would like to change them all to "author name - book title.mobi".
> >
> > I am able to "find" the author name with the regular expression "[ ]-
> > [ ][A-Za-z ]" but then how do I concatenate the characters found in
> > that expression to the beginning of the file name?
>
> Assuming (big assumption) that the filenames are always "some words - some
> other words but no more hyphens," then this should work:
>
> Find:    (.*)\s-\s(.*)
> Replace: $2 - $1
>
> Here's a screenshot taken of a couple of dummy filenames, showing how it'd
> work:
>
>
>
>
> I'm far from a regex wizard, though, so please: test on a copy of your
> files before you commit to this :).
>
> -rob.
> --
> You received this message because you are subscribed to the Name Mangler
> Talk group. To post to this group, send email to
> [email-masked]. To unsubscribe from this group, send
> email to [email-masked].
>
> For more options, visit the Name Mangler Talk web page at <
> http://groups.google.com/group/name-mangler-talk>
>
>

---

From: Rob Griffiths <[email-masked]>
Date: Thu, 1 Dec 2011 22:18:48 -0800

> that expression to the beginning of the file name?

Assuming (big assumption) that the filenames are always "some words - some other words but no more hyphens," then this should work:

Find:    (.*)\s-\s(.*)
Replace: $2 - $1

Here's a screenshot taken of a couple of dummy filenames, showing how it'd work:

I'm far from a regex wizard, though, so please: test on a copy of your files before you commit to this :).

-rob.

---

From: davenelson <[email-masked]>
Date: Thu, 1 Dec 2011 19:38:38 -0800 (PST)