It is currently March 29th, 2024, 1:40 pm

RegExpSubstitute confusion

Get help with creating, editing & fixing problems with skins
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

RegExpSubstitute confusion

Post by StArL0rd84 »

Trying to clean and accommodate for 3 different types of occurrences of titles in my torrent skin.

Interceptor.2022.1080p.NF.WEB-DL.DDP5.1.Atmos.x264-CMRG[TGx]
Dark.Winds.S01E01.WEB.x264-TORRENTGALAXY
Charmed.2018.S04E13.WEB.x264-TORRENTGALAXY

What I would like to see:

Interceptor 2022
Charmed 2018 S04E13
Dark Winds S01E01

Using RegExpSubstitute, and it looks something like this:

RegExpSubstitute="\.":" ","^(.*.\d\d\d\d)(.*)$":'\1'
Works for: Interceptor 2022

RegExpSubstitute="\.":" ","^(.*S\d\dE\d\d)(.*)$":'\1'
Works for: Charmed 2018 S04E13 & Dark Winds S01E01

But combining them into a single line breaks it so it only works for one or the other occurrence, depending on the order.
So need help making the substitute play well with each other.


Torrent skin disclaimer!
I don't want to be responsible for other people illegally downloading torrents, so I will NEVER release my skin to the public.
Nor does my skin link to the files directly, it only displays the image and title of the movie.
Clicking on a image of a movie will only do a search for the title on the site.
User avatar
nek
Posts: 105
Joined: November 3rd, 2019, 12:00 am

Re: RegExpSubstitute confusion

Post by nek »

How about this?

Code: Select all

RegExpSubstitute=1
Substitute="(?si)\.WEB\b.*":"", "(?si)\.(?:720|1080)p\..*":"", "\.":" "
Updated learned from ikarus1969's code below

Code: Select all

RegExpSubstitute=1
Substitute="(?si)\.(?:\d{3,4}p|WEB)\b.*":"", "\.":" "
;Substitute="(?si)\.(?:(?:720|1080)p|WEB)\b.*":"", "\.":" "

Substitute - Rainmeter Docs, PCRE Regex Cheatsheet
regex101.com | Online tester | PCRE (PHP <7.3), Substitusion, REGEX FLAGS=none
Last edited by nek on June 12th, 2022, 4:30 pm, edited 1 time in total.
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: RegExpSubstitute confusion

Post by ikarus1969 »

This one works too (and for more than 720p or 1080p ;-) )

Code: Select all

"(?siU)\.(\d+p|WEB).+$":"","\.":" "
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: RegExpSubstitute confusion

Post by ikarus1969 »

Learned also from neks code that ?: means match but do not capture :bow:
User avatar
nek
Posts: 105
Joined: November 3rd, 2019, 12:00 am

Re: RegExpSubstitute confusion

Post by nek »

ikarus1969 wrote: June 12th, 2022, 2:19 pm

Code: Select all

"(?siU)\.(\d+p|WEB).+$":"","\.":" "
I can share what I have learned before.
I don't use (?siU) in this case. Because (?siU) costs high as a regular expression.

TESTING - regex101.com | PCRE (PHP <7.3), REGEX FLAGS=none

TEST STRING 0123456789abcdefghijklmnopqrstuvwxyz
RegExp (?siU).+$ 39 steps
RegExp (?si).+$ 4 steps


Regular Expression Flags (?siU)

s .(dot) matches newline as well
i Ignore case
U Ungreedy quantifiers

.* and .+ are greedy by default.
RegExp.greedy.png
RegExp (?siU).+$ 39 steps ... same with (?si).+?$
RegExp (?si).+$ 4 steps ... same with (?siU).+?$

What I would like to say is...
ikarus1969's code
"(?siU)\.(\d+p|WEB).+$":"","\.":" "
"(?siU)\.(\d+p|WEB).+?$":"","\.":" " or "(?si)\.(\d+p|WEB).+$":"","\.":" " is faster, I think.
You do not have the required permissions to view the files attached to this post.