perl – Regex to match a pattern unless it’s exactly this other pattern

I have a file with the name:

Show name [x265].mp4

It is being matched using the code found here Video::Filename that you can find here: Video::Filename

This code is supposed to pull out two or three fields, season, episode and (optionally) endep, from the format:

Show name 1x2.mp4

However, with my file is it returning season 2 and episode 65.

The pattern in question is:

(?<openb>\[)?(?<season>\d{1,2})[x\/](?<episode>\d{1,2})(?:-(?:\k<season>x)?(?<endep>\d{1,2}))?(?(<openb>)\])

What is the easiest way to make this pattern reject x265 etc?

Read more here: Source link