get rid of everything after "1080p" in file name

A swapping-ground for Regular Expression syntax

get rid of everything after "1080p" in file name

Postby angeltread » Fri Aug 07, 2020 12:16 am

i got a buncha files like so....

movie title (1999) 1080p bluray x265.mp4
movie title 25 (2006) 1080p webrip online x264.mp4

and so on...
i want to have everything in the file name after "1080p" to be gone. it is a variable amount of characters and spaces...
so that my above example files look like so...

movie title (1999) 1080p.mp4
movie title 25 (2006) 1080p.mp4

anyone that can help me out it is much appreciated.
angeltread
 
Posts: 3
Joined: Fri Aug 07, 2020 12:03 am

Re: get rid of everything after "1080p" in file name

Postby therube » Fri Aug 07, 2020 4:32 pm

1:RegEx
Code: Select all
Match:  (.*)\s1080p
Replace:  \1

Match anything up to a sequence of <space>1080p
Keep the matching part, discard all else
therube
 
Posts: 1022
Joined: Mon Jan 18, 2016 6:23 pm

Re: get rid of everything after "1080p" in file name

Postby angeltread » Sat Aug 08, 2020 1:12 am

therube wrote:1:RegEx
Code: Select all
Match:  (.*)\s1080p
Replace:  \1

Match anything up to a sequence of <space>1080p
Keep the matching part, discard all else


thank you.... on my end though.... that is getting rid of the "<space>1080p" which i am trying to keep that.
here is a screen shot of it doing so.https://drive.google.com/file/d/1f8ogRvGW0X1cO-fVWOVn2HcXYuPC7i2X/view?usp=sharing
angeltread
 
Posts: 3
Joined: Fri Aug 07, 2020 12:03 am

Re: get rid of everything after "1080p" in file name

Postby therube » Sat Aug 08, 2020 7:17 pm

Heh, oops.

Try this:
Code: Select all
Match:  (.*1080p)
Replace:  \1
therube
 
Posts: 1022
Joined: Mon Jan 18, 2016 6:23 pm

Re: get rid of everything after "1080p" in file name

Postby angeltread » Mon Aug 10, 2020 2:56 am

therube wrote:Heh, oops.

Try this:
Code: Select all
Match:  (.*1080p)
Replace:  \1


so much yes. thanks killer, you are a true magic man.
angeltread
 
Posts: 3
Joined: Fri Aug 07, 2020 12:03 am

Re: get rid of everything after "1080p" in file name

Postby Admin » Thu Sep 10, 2020 12:30 am

Just for the records in the latest version you can also use "simple" regular expressions ( switch on option "Simple" in RegEx(1) ). Then match and replace become:

Match:
%1 1080p
Replace
%1

% matches a string of any characters like (.*) in a full regex.
Admin
Site Admin
 
Posts: 2059
Joined: Tue Mar 08, 2005 8:39 pm


Return to Regular Expressions