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

    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0

    Resorting parts of a file name with multiple extensions


    Input (date time - channel - movie title.extensions):
    20130215 0250 - Das Erste HD - Psycho.ts
    20130215 0250 - Das Erste HD - Psycho.ts.ap
    20130218 0125 - RTL HD - Der Herr der Ringe - Die Rückkehr des Königs.ts
    20130119 0815 - Sky Cinema +24 - Sherlock Holmes_ Spiel im Schatten.ts_mp

    Desired Output (movie title - channel - date time.extensions):
    Psycho - Das Erste HD - 20130215 0250.ts
    Psycho - Das Erste HD - 20130215 0250.ts.ap
    Der Herr der Ringe - Die Rückkehr des Königs - RTL HD - 20130218 0125.ts
    Sherlock Holmes_ Spiel im Schatten - Sky Cinema +24 - 20130119 0815.ts_mp

    Regex which works only in the case with one extension (like ".ts", but not for ".ts.ap"):
    (.*) - (.*) - (.*)\.(.*?)
    $3 - $2 - $1.$4

    How to deal with multiple extensions? The regex should work regardless the number of extensions which are seperated by a dot.

    Thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Location
    Paris area, France
    Posts
    840
    Rep Power
    496
    Hi,

    try this:

    (.*) - (.*) - ([^.]*)\.(.*)

    Comments on this post

    • gotcha44 agrees
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0

    Thank you


    it works. thanks.

IMN logo majestic logo threadwatch logo seochat tools logo