Keep a part of a folder name

A swapping-ground for Regular Expression syntax

Keep a part of a folder name

Postby Icke » Sun Aug 20, 2017 1:22 pm

Hello!

Since 2 or 3 hours I'm trying several RegEx strings for my problem but nothing works.

I have a lot of folders named like

1999_06_00_Darkangel_[Promo]
2000_04_03_Standing_-_Burning_Empires
2002_03_00_Beloved

I like to rename it to
1996_06_00 Darkangel (Promo)
2000_04_03 Standing - Burning Empires
2002_03_00 Beloved

Would be great if someone has a solution.
Thanks in advance.
Icke
 
Posts: 2
Joined: Sun Aug 20, 2017 1:13 pm

Re: Keep a part of a folder name

Postby KenP » Sun Aug 20, 2017 6:54 pm

The easiest way to do this seems to be to use "Replace (3) to replace all the underscores with a space, then use Character Translations to replace the brackets with parenthesis then use regex to replace the underscores in the dates.

1.
Replace (3)
Replace: _
With: <space>

2.
Specials (14)
Character Translations:
[=(
]=)

3.
RegEx (1)
Match: (\d{4})\s(\d{2})\s(\d{2})(.*)
Replace: \1_\2_\3\4
KenP
 
Posts: 193
Joined: Sat Jul 30, 2016 11:25 am

Re: Keep a part of a folder name

Postby Icke » Wed Aug 23, 2017 9:38 pm

Thanks a lot KenP.
It does exactly what I wanted.
Icke
 
Posts: 2
Joined: Sun Aug 20, 2017 1:13 pm


Return to Regular Expressions


cron