截取字符串方法(传入开头和结束参数)
2012年02月09日
⁄ 综合
⁄ 共 455字 ⁄ 字号
小 中 大
Code
public static MatchCollection getAllHyperLinks(String text,String s,string e)
{
try
{
Regex rg = new Regex("(?<=(" + s + "))[.\\s\\S]*?(?=(" + e + "))", RegexOptions.Multiline | RegexOptions.Singleline);
MatchCollection matches=rg.Matches(text);
return matches;
}
catch (Exception ex)
{
return null;
}
}