Rename Folders based on previous snippets with various form

A swapping-ground for Regular Expression syntax

Rename Folders based on previous snippets with various form

Postby kjhardy » Tue Sep 29, 2015 6:52 pm

Hi, I have folders I'd like to rename but the original folder names have various formats.

In example..

[Word] - 2005 -> Word 2005 with or without - in original
[Word1-Word2] - 2009 -> word1word2 2009 with or without second - original
Word1-Word2 - 2009 r -> word1word2 2009 with or without r in original
Word1-Word2.com - 2009 r -> word1word2 2009 with or without r in original

The only thing I'm able to accomplish is getting the date (\d+)

Any help would be appreciated
kjhardy
 
Posts: 3
Joined: Tue Sep 29, 2015 6:34 pm

Re: Rename Folders based on previous snippets with various form

Postby kjhardy » Wed Sep 30, 2015 5:45 pm

Well I made some progress but I'm still having issues

For the folder [Word1-Word2] - 2009 I was able to use match (^\[(.*?)-(.*?)\]\s* - (\d+)) replace \1\2 \3 outputs Word1Word2 2009
then for the folder [Word] - 2005 match ^\[(.*?)\] - (\d+) replace \1 \2 outputs Word 2005
folder Word1-Word2 - 2009 r match ^(.*?)-(.*?) - (\d+) replace \1\2 \3 outputs Word1Word2 2009

I don't have an expression for the .com folder and I don't know how to put these expressions together for alternative matches.

Any help?

Thx,
Ken
kjhardy
 
Posts: 3
Joined: Tue Sep 29, 2015 6:34 pm

Re: Rename Folders based on previous snippets with various form

Postby Stefan » Mon Oct 05, 2015 11:38 am

Hi Ken, welcome.

If I understood correctly, you want to...

FROM:
[Word] - 2005.ext
[Word] 2006.ext
[Word1-Word2] - 2009.ext
[Word1-Word2] 2010.ext
Word1-Word2 - 2007 r.ext
Word1-Word2 - 2011.ext
Word1-Word2.com - 2009 r.ext
Word1-Word2.com - 2012.ext


TO:
Word 2005.ext
Word 2006.ext
Word1Word2 2009.ext
Word1Word2 2010.ext
Word1Word2 2007 r.ext
Word1Word2 2011.ext
Word1Word2 2009 r.ext
Word1Word2 2012.ext



TRY:

Repl.(3)
Repla: .com
With:

Remove(5)
[x] D/S
[x] Sym.


RENAME 1st time.

RENAME a second time with "Remove(5): [x] D/S" to remove left over double spaces.
(that should have been done on first renaming, but doesn't seems to work?. So just another run.)

 
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Rename Folders based on previous snippets with various form

Postby kjhardy » Mon Oct 05, 2015 2:55 pm

Hi Stefan, Thanks for the reply.
Why was I trying to make it so complicated?!
Thanks for the suggestions. Works great.
Best,
Ken
kjhardy
 
Posts: 3
Joined: Tue Sep 29, 2015 6:34 pm


Return to Regular Expressions