Please help!

A swapping-ground for Regular Expression syntax

Please help!

Postby thERDfAs » Fri Aug 14, 2020 5:33 pm

How do I rename all files for example:

Before:
01 - 2Pac - Soldier Like Me.

After:
01 - Soldier Like Me
thERDfAs
 
Posts: 5
Joined: Fri Aug 14, 2020 5:30 pm

Re: Please help!

Postby thERDfAs » Fri Aug 14, 2020 7:43 pm

Ok I'm getting close:

Under Replace (3)
Replace: - 2Pac -
With: -

01 - 2Pac - Soldier Like Me (Album Version Explicit)
becomes
01 - Soldier Like Me (Album Version Explicit)

How do I make anything between - 2Pac - dynamic?
thERDfAs
 
Posts: 5
Joined: Fri Aug 14, 2020 5:30 pm

Re: Please help!

Postby thERDfAs » Fri Aug 14, 2020 8:08 pm

I found this which works well in my case!

viewtopic.php?f=4&t=4776&p=12669&hilit=remove+artist#p12669
thERDfAs
 
Posts: 5
Joined: Fri Aug 14, 2020 5:30 pm

Re: Please help!

Postby thERDfAs » Fri Aug 14, 2020 8:11 pm

Can someone please break this down and how this works exactly for future reference? Thanks!

#1Regex Match/Replace:
^(\d+ - ).+? - (.+)$
\1\2

Number - Artist - Title ---> Number - Title
thERDfAs
 
Posts: 5
Joined: Fri Aug 14, 2020 5:30 pm

Re: Please help!

Postby therube » Sat Aug 15, 2020 4:59 pm

^(\d+ - )
starts with 1 or more digits, followed by a <sp><dash><sp>

.+? -
1 or more characters (any characters) - non-greedy, followed by a <sp>dash><sp>
(that's your [ 2pac - ])

(.+)$
everything else that follows to the end
therube
 
Posts: 1025
Joined: Mon Jan 18, 2016 6:23 pm

Re: Please help!

Postby thERDfAs » Mon Aug 17, 2020 12:31 am

Thank you so much for replying! :D :D
thERDfAs
 
Posts: 5
Joined: Fri Aug 14, 2020 5:30 pm


Return to Regular Expressions