how do i delete substring

A swapping-ground for Regular Expression syntax

how do i delete substring

Postby cns00 » Sun Jan 05, 2020 8:23 pm

i have file names like this:-
Dora.And.The.Lost.City.Of.Gold.2019.720p.BluRay.x264
Nine.Lives.2016.1080p.BluRay.x264
Maleficent.Mistress.Of.Evil.2019.720p.WEBRip.x264

i need to find the first four digit numbers which are for the year and then delete everything starting from the . before those numbers till the end of the file name. thus the names will become:-
Dora.And.The.Lost.City.Of.Gold
Nine.Lives
Maleficent.Mistress.Of.Evil

i also want to do it if the file name contains 720p or 1080p

how do i do what i want?
cns00
 
Posts: 1
Joined: Sun Jan 05, 2020 8:08 pm

Re: how do i delete substring

Postby therube » Mon Jan 06, 2020 3:28 pm

1:Regex
Code: Select all
Match:  (.*?)\.\d\d\d\d
Replace:  \1


Match anything (non-greedy), up to (dot)(digit)(digit)(digit)(digit)

Code: Select all
tag.(67.1999.720i) - Copy - tag.(67.1999.720i).mkv
tag.(67.mkv


Not sure what you meant to exclude the extension or not?
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm


Return to Regular Expressions