关于正则表达式 被搜索字符串,中间有换行。[email protected] [email protected] [email protected] [email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected]怎样才能匹配出每一行,正则怎么写? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 @"\b\S*\n\b" 为什么我用这个去匹配行不通?只能匹配部分 string str = @"[email protected] [email protected] [email protected] [email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected]"; MatchCollection mc = Regex.Matches(str, "^.*?$", RegexOptions.Multiline); Response.Write(mc.Count.ToString()); string[] lines = Regex.Split(yourStr,@"\r?\n"); string mail = @"[email protected] [email protected] [email protected] [email protected][email protected] [email protected][email protected][email protected][email protected][email protected][email protected][email protected]"; string[] mails = mail.Split('\n'); foreach(string str in mails) { Console.WriteLine(str); } string[] strs = str.Split(new char[]{'\n'}, StringSplitOptions.RemoveEmptyEntries); 为什么要用正则,这样不行吗?string[] result = yourStr.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);foreach (string s in result){ richTextBox2.Text += s + "\n----------------\n";} c# 运行错误! c#中如何操作word 请问c#如何去除关闭按钮? 还有如何在程序中接受并处理诸如WM_NCPAINT、WM_NCACTIVATE等消息事件 简单问题:为什么我的下载的C#代码不能运行?? 如何判断一个excel文件打开的?20分 在windows form里面嵌入一个web browser,怎么样捕获事件? 老兄,请帮我看看。这样错在哪里了? C#中该怎么发自定义消息? 请教下WPF窗体控件的问题 dtatable 去掉一列 【在线等,急】把网络上的资源导入数据库
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]"; MatchCollection mc = Regex.Matches(str, "^.*?$", RegexOptions.Multiline);
Response.Write(mc.Count.ToString());
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
";
string[] mails = mail.Split('\n'); foreach(string str in mails)
{
Console.WriteLine(str);
}
foreach (string s in result)
{
richTextBox2.Text += s + "\n----------------\n";
}