RegExp-匹配文件名(MediaPortal电视系列插件) [英] RegExp - Match File Name (MediaPortal TV-Series Plugin)

查看:86
本文介绍了RegExp-匹配文件名(MediaPortal电视系列插件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



尝试为MediaPortal的TV系列插件制作正则表达式(以前从未使用过regexp).基本上,它将文件名与特定的电视连续剧,季节,剧集等匹配.

我在这样搜索的目录中有文件:

\ Sport \ Football \一天的比赛\ 2011-2012 \一天的比赛(2011-12-10)[1080i] .mkv
\ Sport \ Football \一天的比赛\ 2011-2012 \一天的比赛(2011-12-17)[1080i] .mkv
\ Sport \ Football \一天的比赛\ 2011-2012 \一天的比赛(2011-12-24)[1080i] .mkv
等.


我正在使用以下正则表达式,但它无法正常工作,甚至似乎与文件名的任何部分都不匹配:

Hi,

Trying to make a regular expression for the TV-Series plugin for MediaPortal (never used regexp before). Basically it matches a file name with a certain TV series, season, episode, etc.

I have files in a directory being searched like this:

\Sport\Football\Match of the Day\2011-2012\Match of the Day (2011-12-10) [1080i].mkv
\Sport\Football\Match of the Day\2011-2012\Match of the Day (2011-12-17) [1080i].mkv
\Sport\Football\Match of the Day\2011-2012\Match of the Day (2011-12-24) [1080i].mkv
etc.


I''m using the following regexp but it doesn''t work and it doesn''t even seem to match any part of the file names:

Sport\\Football\\Match of the Day\\201[0-9]-201[1-9]\\<series>\s\(<firstaired>\).<ext>



应该将"series","ext"和"firstaired"送入程序.我也尝试过忽略目录结构(就像一些内置的正则表达式一样):



"series", "ext" and "firstaired" are supposed to be fed into the program. I''ve also tried ignoring the directory structure (as some of the built-in regular expressions do):

<series>\s\(<firstaired>\).<ext>



但这也不起作用. :/

这是一些内置正则表达式的示例,它们也无法检测到这些文件:



but this doesn''t work either. :/

Here''s a couple of examples of built-in regular expressions that also fail to detect these files:

^(?:.*\\)?(?<series>[^\\]+?)[ _.\-\[]+(?:[s]?(?<season>\d+)[ _.\-\[\]]*[ex](?<episode>\d+)|(?:\#|\-\s)(?<season>\d+)\.(?<episode>\d+))(?:[ _.+-]+(?:[s]?\k<season>[ _.\-\[\]]*[ex](?<episode2>\d+)|(?:\#|\-\s)\k<season>\.(?<episode2>\d+))|(?:[ _.+-]*[ex+-]+(?<episode2>\d+)))*[ _.\-\[\]]*(?<title>(?![^\\].*?(?<!the)[ .(-]sample[ .)-]).*?)\.(?<ext>[^.]*)$





(?<series>[^\\\[]*) - \[(?<season>[0-9]{1,2})x(?<episode>[0-9\W]+)\](( |)(-( |)|))(?<title>(?![^\\]*?sample)[^$]*?)\.(?<ext>[^.]*)


(^.*?\\?(?<series>[^\\$]+?)[ .-]+(?<firstaired>\d{2,4}[.-]\d{2}[.-]\d{2,4})[ .-]*(?<title>(?![^\\]*?(?<!the)[ .(-]sample[ .)-]).*?)\.(?<ext>[^.]*)$)



感谢您提供任何想法!



Thanks for any ideas!

推荐答案





(?<series>[^\\\[]*) - \[(?<season>[0-9]{1,2})x(?<episode>[0-9\W]+)\](( |)(-( |)|))(?<title>(?![^\\]*?sample)[^


*?)\.(?<ext>[^.]*)
*?)\.(?<ext>[^.]*)


(^.*?\\?(?<series>[^\\


+?)[.-] +(?< firstaired> \ d {2 ,4} [.-] \ d {2} [.-] \ d {2,4})[.-] *(?< title>(?![^ \\] *?(?< ;! the)[.(-] sample [.)-]).*?)\.(?< ext> [^.] *)
+?)[ .-]+(?<firstaired>\d{2,4}[.-]\d{2}[.-]\d{2,4})[ .-]*(?<title>(?![^\\]*?(?<!the)[ .(-]sample[ .)-]).*?)\.(?<ext>[^.]*)


这篇关于RegExp-匹配文件名(MediaPortal电视系列插件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆