Remove everything before the first - and others

A swapping-ground for Regular Expression syntax

Remove everything before the first - and others

Postby blackshadow » Thu Jul 15, 2021 4:56 pm

Hi! I would like to ask for some help on how to bulk rename 38 videos in my computer right now.
This is the sample filename of some of my videos: yt1s.com - Pokémon Ultra Sun Catching Coballion_480p
What I want to happen is that I want to remove the "yt1s.com - " (yes including the space after the first dash), adding a - between "Pokémon Ultra Sun" and "Catching Coballion", adding a bracket between Ultra Beast if the name has it, and removing the _480p
Example 1
1. yt1s.com - Pokémon Ultra Sun Catching Dialga_480p into Pokémon Ultra Sun - Catching Dialga
2. yt1s.com - Pokémon Ultra Sun Catching Cresselia_480p into Pokémon Ultra Sun - Catching Cresselia
3. yt1s.com - Pokémon Ultra Sun Catching Blacephalon Ultra Beast_480p into Pokémon Ultra Sun - Catching Blacephalon (Ultra Beast)
4. yt1s.com - Pokémon Ultra Sun Catching Guzzlord Ultra Beast_480p into Pokémon Ultra Sun - Catching Guzzlord (Ultra Beast)
Please take note that the space between Pokémon Ultra Sun and Catching (name) has 2 spaces, which means a dash can simply be added on the middle so that it will look like
" - ", say for example Pokémon Ultra Sun Catching Cresselia into Pokémon Ultra Sun - Catching Cresselia
I am making a back up of my YouTube videos, and I had to use a website to get it for me, thank you very much for your help guys!
blackshadow
 
Posts: 2
Joined: Thu Jul 15, 2021 4:30 pm

Re: Remove everything before the first - and others

Postby Luuk » Thu Jul 15, 2021 7:03 pm

The easy way is probably using Replace(3) with a 'Replace' and 'With' like...
Code: Select all
yt1s.com - |  |_480p|Ultra Beast
| - ||(Ultra Beast)

But if its not good enough, then RegEx(1) needs a checkmark in 'v2', with a 'Match' and 'Replace' like...
^yt1s.com - (Pokémon Ultra Sun )( Catching .*?)(_480p)?$(?X)(Ultra Beast)
$1-$2(?X)\($1\)
Luuk
 
Posts: 320
Joined: Fri Feb 21, 2020 10:58 pm

Re: Remove everything before the first - and others

Postby blackshadow » Fri Jul 16, 2021 8:22 am

Thank you so much! the Match and Replace code with v2 works really well, thank you again for your help! I really appreciate it.
blackshadow
 
Posts: 2
Joined: Thu Jul 15, 2021 4:30 pm


Return to Regular Expressions