なぜこの正規表現パターンは「Season 02 Episode 01」という文字列を正しく解析しないのですか?正規表現の問題の解析シーズン/エピソードパターン
例えば、これは一致しない。
var fileName = "Its Always Sunny in Philadelphia Season 02 Episode 01 - Charlie Gets Crippled.avi"
// Regex explanation:
// Starts with "S" and can contain more letters, can continue with space, then contains two numbers.
// Then starts with "E" again and can contain more letters, can continue with space, then contains two numbers.
var pattern = @"S\w?\s?(\d\d)\s?E\w?\s?(\d\d)";
var regex = new Regex(pattern, RegexOptions.IgnoreCase);
var match = regex.Match(fileName);
あなたは絶対に正しいです、それは私の間違いでした。これは固定パターンです:var pattern = @ "S \ w * \ s *(\ d \ d)\ s * E \ w * \ s *(\ d \ d)"; –