Matching TV and Movie File names with Regex

前端 未结 2 1413
有刺的猬
有刺的猬 2021-01-29 00:35

I\'ve been working on getting a regular expression to grab the TV Show or Movie name, the year it was aired if it exist, the season #and the episode # from the file name of a vi

2条回答
  •  时光说笑
    2021-01-29 01:10

    if i may, i adapted brian's regex to match something like

    SHOW.NAME.201X.SXXEXX.XSUB.VOSTFR.720p.HDTV.x264-ADDiCTiON.mkv

    here it is (PHP PCRE)

    /^(
        (?P.*[^ (_.]) # Show name
            [ (_.]+
            ( # Year with possible Season and Episode
                (?P\d{4})
                ([ (_.]+S(?P\d{1,2})E(?P\d{1,2}))?
            | # Season and Episode only
                (?\d{1,2})E(?P\d{1,2})
            )
    |
            # Show name with no other information
            (?P.+)
    )/mx
    

提交回复
热议问题