Remove after last hyphen

A swapping-ground for Regular Expression syntax

Remove after last hyphen

Postby JOLLYGREENGIANT » Sat Apr 09, 2022 8:25 pm

I have a bunch of files of youtube videos that have file names that are the date uploaded, the actual title on youtube, followed by a dash and a string of 11 characters and the amount of views it had when it was downloaded. I'd like to remove the last '-' and everything after so that way the file name is just the date uploaded and the actual youtube title. But some of them have a dash in the string of 11 characters. So is there an easy way of doing what I want?

Example file name: 20150810 WOMB RAIDER - Demo Disk Gameplay - 203Q7xbET_c [1407029 views]
Example file name: 20150822 GET REAPED - Dead Realm Gameplay - cptP-4XVCUE [596705 views]

Example of what I want: 20150810 WOMB RAIDER - Demo Disk Gameplay
Example of what I want: 20150822 GET REAPED - Dead Realm Gameplay
JOLLYGREENGIANT
 
Posts: 3
Joined: Wed Jun 30, 2021 7:07 am

Re: Remove after last hyphen

Postby Admin » Mon Apr 11, 2022 2:25 am

Hi, if you use RegEx (1) and enable the option "Simple" in there, then

Match : %1 - %2 - %3
Replace: %1 - %2
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm


Return to Regular Expressions