Help creating regex for unwanted results

Hi, I’ve some difficult to create a regular expression to exclude unwanted downlod

sometimes, bad releaser, put strange names, for example

Lucifer S03e15 [XviD - Eng Mp3 - Sub Ita Eng] DLRip By Pir8 [CURA] Fede e Religioni
Lucifer S03e01-08 [XviD - Eng Mp3 - Sub Ita Eng] DLRip By Pir8 [CURA] Fede e Religioni SEASON PREMIERE
Young Sheldon S01e13 [SATRip 720p - H264 - Eng Ac3 - Sub Ita] HDTV by AVS

I want to download Italian release, sonarr in this case download the rel, but is wrong! This’s a eng rel with sub ita.
I can’t simply exclude sub ita because happen most of times that also inside italian release, sub are present so … a regex is needed, but I’ve so difficult to make a string where I’ve to reject rel with
Eng [some extra char, for example AC3 or mp3 or some - or . or others] sub ita

For now this’s what I got
\b(eng\w{0,10}sub ita|hevc)\b/i

Please don’t consider for now hevc is only a memo for me to insert variations about various possibilities.

What I miss?

Ok, I’m here:
/\beng\W+(?:\w+\W+)sub\s?ita\b/i
But I’ve a problem with this
Young Sheldon S01e08 [Mux 1080p - H264 - Ita Eng Ac3 - Sub Ita Eng] WEBMux Morpheus
Because match the eng … sub ita, but this is Ita eng … sub ita and is fine!

How to tell that ita eng … sub ita is right and eng … sub ita don’t?

I always use https://regex101.com

Works great with script assistance.

I use it, lol, the very fist problem is that I’m not confortable with regex!

https://regex101.com/r/9HVKTK/1/

Like you can see, 3 of 4 must be match expect the last one, but I can’t find a way to make it right!

Any idea?

Hi, I’m with Sonarr Ver. 2.0.0.5162

With some stackoverflow help, maybe I found one regex that do what I need, the only problem now is that if I put into Sonarr, on a manual search Sonarr tell me
unrecognized escape sequence \K
On all possible rel, even the good one

The code with all example can be found here
or you can see it here:
/^(?:(?!\b(eng|ita)\b).)*\K\beng\W+\w+\W+sub\s?ita\b/i

So the possible solution don’t works inside Sonarr but works outside.

What can be? How to make it work on Sonarr?

Jo

\K is some perl specific escape for look behinds.

C# does support look behinds via a different syntax.

(?<=) Match prefix, but exclude it from the match
(?<!) Match if the prefix is not present

So \K don’t works in Sonarr?
Because if I replace it with (?<=) or (?<!) the result are completly different

No, \K doesn’t work. What you replace it with will depend what you’re trying to do exactly.

Based on what you said in your original post I think I understand somewhat what you want, but without an example showing exactly what you do want and don’t want I’m not sure.

Not sure why you need a look around at all, given what you want to exclude something like:
\beng.+?sub[-._ ]ita

Should work (assuming I’m understanding your original post correctly).

Ok, the problem happen when Sonarr don’t recognize correctly some release, for example:

Lucifer S03e01-08 [XviD - **Eng Mp3 - Sub Ita Eng**] DLRip By Pir8 [CURA] Fede e Religioni SEASON PREMIERE
Young Sheldon S01e13 [SATRip 720p - H264 - **Eng Ac3 - Sub Ita**] HDTV by AVS
Morpheus The.Breadwinner.2017.**ENG.Sub.ITA**.HDRip.XviD-[WEB]

All those are in english, for the last one I think there’s no problem, but the first 2 are recognized as english by far from Sonarr.

So my idea was to make a regex to exclude bad results
Look at https://regex101.com/r/VzspFy/15
Works but \K is present :frowning:

Here a solution without \K https://regex101.com/r/VzspFy/14
But I don’t know if can I’ve some issue in future

Any idea about \K is not handled? Or any alternative solution without regex?

What do you expect Sonarr to do with the first two releases?

It’s for perl, not .net.

It’s unclear what you’re trying to do exactly, but for multi word rejections without consistent separators/spaces, regex is probably your best bet.

Ok I try to explain myself in a better way that I can

Sometimes sonarr don’t recognize correctly a release, for example I search a tv show with Italian profile, and I do a search so sonarr grab this
Lucifer S03e15 [XviD - Eng Mp3 - Sub Ita Eng] DLRip By Pir8 [CURA] Fede e Religioni
But this is an english release, not italian.

So I’ve to use a regex to make it works.

By the way, is possible to make insert a profile name in Restrictions? Actually there’s a tag, but if I specify a tag, for each tv show that I follow I’ve to add the same tag, even on new series I’ve to edit and insert a tag. But if you add into Restrictions, a field where I can select a profile name, I can also, for example, tell to apply one restriction only when I use one ore more profile name. Clear enough?

Does the regex I posted not work for that? Add it as a rejection and it’ll catch it (as long as it’s set to be case insensitive.

No they are set via tags. There will be changes in the future to support adding tags when adding series.

https://regex101.com/r/VzspFy/17

This for now works.
I use 2 profile, one italian and one english, so I hope this regex don’t preclude any english release, for that I asked you if is possible add a filter inside restriction that match to profile name

You want to only link it to series you are also using the italian profile on…

yep, I’ve to tag about 70 tv show :smiley:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.