我试图创建在C#中的正则表达式来提取一个文件名艺术家,曲目编号和歌曲名称命名,如:01.artist - 现在title.mp3问题产生的正则表达式匹配文件名
我可以”不要让事情发挥作用,并且在网上寻找相关的帮助时遇到问题。
这是我到目前为止有:
string fileRegex = "(?<trackNo>\\d{1,3})\\.(<artist>[a-z])\\s-\\s(<title>[a-z])\\.mp3";
Regex r = new Regex(fileRegex);
Match m = r.Match(song.Name); // song.Name is the filname
if (m.Success)
{
Console.WriteLine("Artist is {0}", m.Groups["artist"]);
}
else
{
Console.WriteLine("no match");
}
我没有得到任何比赛都和所有帮助表示赞赏!
+1为快报链接 – TLiebe 2009-09-01 15:53:11