日期:2014-05-18  浏览次数:20472 次

我想用正则表达式从一段文字中取出<title></title>之间的文字该如何做呢
我想用正则表达式从一段文字中取出 <title> </title> 之间的文字该如何做呢

------解决方案--------------------
<titile> (.*?) <title>

------解决方案--------------------


string t= " <titile> ssss </title> ";
System.Text.RegularExpressions.Regex reg= new System.Text.RegularExpressions.Regex(@ "\ <titile\> (.*?)\ </title\> ");
System.Text.RegularExpressions.Match m = reg.Match(t);
Console.WriteLine(m.Groups[0].Value);
------解决方案--------------------
try

string result = string.Empty;
Match m = Regex.Match(yourStr, @ "(? <= <title> )[\s\S]*?(?= </title> ) ", RegexOptions.IgnoreCase);
if (m.Success)
{
result = m.Value;
}
------解决方案--------------------
过客的正则总是这么牛!
------解决方案--------------------
<titile> (.*?) <title>

======

无法匹配换行符