#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2010
    Posts
    1
    Rep Power
    0

    TV Scene Release Regular Expression


    Hi,

    I'm having some difficulty writing a regular expression which matches all the various formats a scene release television episode can come in.

    This is what I have so far:
    Code:
    (.*)[s|S|]([0-9]{1,2})[x|X|e|E|]([0-9]{2})(.*)
    Here are my test strings:
    Code:
    These are caught:
    Lost.S05E16.DVDRip.XviD-TOPAZ
    lost.s06e01-e02.hdtv.xvid-2hd
    Greys.Anatomy.S05E01E02.HDTV.XViD-DOT
    
    These are not:
    Desperate.Housewives.2x22.No_One_Is_Alone.DVDRip_XviD-FoV
    Desperate.Housewives.2x23.2x24.Remember.DVDRip_XviD-FoV
    Sex_And_The_City.6x08.The_Catch.DVDRip_XviD-FoV
    Desperate_Housewives.2x13.Theres_Something_About_A_War.DVDRip_XviD-FoV
    All of these will be caught by the regexp, if I simply enter a 's' before the season number on each file. It still doesn't account for multi-part episodes, however. What I would like is for the regexp to catch all of these in four groups (show, season, episode, the rest) and if one is a multi-part episode, return with as many groups as needed to get each episode in its own group.

    For instance:
    Code:
    Desperate.Housewives.2x23.2x24.Remember.DVDRip_XviD-FoV
    would return:
    Code:
    group 1: Desperate.Housewives
    group 2: 2
    group 3: 23
    group 4: 24
    group 5: Remember.DVDRip_XviD-FoV
    I'd appreciate any help you can give me on this! It's been tearing my brain for a while now
  2. #2
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6352
    Generally, piracy is frowned upon around here, you won't get much help.

    Especially now that this thread is closed.

    -Dan
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

IMN logo majestic logo threadwatch logo seochat tools logo