正则表达式截取字符串问题
八公山民 2009-08-12 11:01:54 string MatchException = Regex.Match(FileBlocks[i], @"\b(异常:)[\s\S]*").ToString();
string MatchExceptionMod = Regex.Replace(MatchException, @"[异常:]", "").ToString();
要截取的字符串如下:
异常:
Saaaaaaystem.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.DivideByZeroException: Attempted to divide by zero.
at ttt.MMTT.BLL.Logistics.Cus.Excep.GetValue(Int32 a, Int32 b)
at TTT.MMTT.BLL.Logistics.Cus.Excep.GetValue(Int32 a, Int32 b)
上面正则是取"异常"后面的字段存取到datatable,绑定到datagridview中,怎么才能去除异常后面的空行?因为导出到excel格式出现了问题.Saaaaaaystem.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.DivideByZeroException: Attempted to divide by zero.
at ttt.MMTT.BLL.Logistics.Cus.Excep.GetValue(Int32 a, Int32 b)
at TTT.MMTT.BLL.Logistics.Cus.Excep.GetValue(Int32 a, Int32 b) 上面这个字符串本来在第二行第5列,串到了 下下行的第一列。请高手从语法上分析怎么截取合适。