MSDN或者网上都说 . 匹配除 "\n" 之外的任何单个字符。要匹配包括 '\n' 在内的任何字符,请使用象 '[.\n]' 的模式。
不知是什么原因没能匹配.. string content = @"123a
bb
ccc123";
string regular = @"123[.\n]*123";
Regex regex = new Regex(regular, RegexOptions.Multiline); MatchCollection list = regex.Matches(content);
前后的123是固定的..
不知是什么原因没能匹配.. string content = @"123a
bb
ccc123";
string regular = @"123[.\n]*123";
Regex regex = new Regex(regular, RegexOptions.Multiline); MatchCollection list = regex.Matches(content);
前后的123是固定的..
string pattern = @"(?im)123(.|\n)*123";.放在[]中就是表示.不表示任意字符
\S\s表示所有字符(非空白字符和空白字符)
string pattern = @"(?s)123.*";