我試圖創建在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