Media Companion
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Media Companion

Discussion and development board for the program Media Companion.
HomeHome  SearchSearch  RegisterRegister  Log inLog in  


 A better regex?

Go down 
2 posters

Posts : 556
Join date : 2008-10-08
Location : Australia

A better regex? Empty
PostSubject: A better regex?   A better regex? Icon_minitimeWed Jan 13, 2010 4:02 am

A recent user of MC had an issue with MC not returning the correct season & episode information from the show they where trying to use. That show was named 3x3 Eyes
Now the issue here is that the 3x3 is also one of the methods to name the season & episodes of a particular Tv show. An example of the full path of one of these shows would be something like this....

C:\Video\TV Shows\3x3 Eyes\1x01 - Transmigration.avi

The issue is is that because the regex looks left-to-right it finds a match with 3x3 & so returns with Season 3 & Episode 3. If the Season & episode had been writen like this....

C:\Video\TV Shows\3x3 Eyes\S01E01 - Transmigration.avi

it would have been fine, since in MC the regex test for the S??E?? format is tested before the ??x?? method & once the first match is found MC moves onto the next video file.

MC has 3 regex test built in, S??E??, ??x?? & ????. The last is just simply defining say Season 1 Episode 1 as 0101. This is left to last in MC since any video path containg a 4 digit year will trigger the regex.

So if you had.....

C:\Backup 2009\Video\TV Shows\Two & A Half Men\0403.avi

the regex would return the season as 20 & the Episode number as 09.

Is there a better way?
Well the 3x3 show bugged me a bit, I had a few solutions that I really wasn't happy with before I came across a better one.....
What I wanted was to return the last match, not the first......that way it will still work if there is only one match, but the filename component takes priority over the rest of the path of the video file - as you would want.

The basis of the next regex is from this web site....

the regex example they give is quite simple.....


In this case it returns the last foo in a text string.

So for our regex's we just need to replace both foo's with our current regex's, so the new regex's become.

([\d]{1,2}) ?[xX] ?([\d]{1,2})(?!.*([\d]{1,2}) ?[xX] ?([\d]{1,2}))

I've tested each of these with my test path below succesfully in MC....

C:\2009\21x4 Eyes\S01E01\S07E02 7x3 704.avi

all regex's return the season 7 & relavent episode number.

Back to top Go down
Senior Member
Senior Member

Posts : 81
Join date : 2011-05-09

A better regex? Empty
PostSubject: Re: A better regex?   A better regex? Icon_minitimeFri May 20, 2011 5:40 am

when you put it on, you will find stunning transformations have been made on your look. Each breath you take becomes more princess-like. Then, how can you discover the really needed wedding gown?
Providing a diverse selection of 2011 prom dresses along with our affordable 2011 prom dresses under $200. Our Muslim Wedding Dresses online store features cheap Muslim Wedding Dresses, discounted islamic wedding dresse. Shop Prom Girl for sweet 16 dresses, sweet sixteen dresses, sweet sixteen Cheap Party Dresses, and dresses for sweet 16.
Almost anytime, it's a must to keep an open mind to
Back to top Go down
A better regex?
Back to top 
Page 1 of 1
 Similar topics
» TV Show regex help
» Regex problem tv scrapper
» TV Scraper Regex priority
» V3.230 TV Preferences not sticking & Regex Missing
» episodes not scraping

Permissions in this forum:You cannot reply to topics in this forum
Media Companion :: Media Companion :: General Discussion-
Jump to: