想要的结果:
2006076 04 10 17 21 29 32 14 08
2006075 10 21 22 23 25 33 11
...............
6 个解决方案
#1
顶
#2
试试这个:
(200[\\d]{4}(\s[\d]{2})*)
(200[\\d]{4}(\s[\d]{2})*)
#3
刚才相反的结果.我是用Replace
#4
string filecontent=..............
Regex reg=new Regex(@"([\d]{7}\s)([\d]{2}\s)+");
System.Text.RegularExpressions.MatchCollection matches=reg.Matches(filecontent);
for(int i=0;i<matches.Count;i++)
Console.WriteLine(matches[i].Value);
Regex reg=new Regex(@"([\d]{7}\s)([\d]{2}\s)+");
System.Text.RegularExpressions.MatchCollection matches=reg.Matches(filecontent);
for(int i=0;i<matches.Count;i++)
Console.WriteLine(matches[i].Value);
#5
~倒
string s="输入字符";
string reg="[\\s\\S]*?(200[\\d]{4}(\\s[\\d]{2})*)[\\s\\S]*?";
string reg2="<br />[^\\d][^\\n]*";
s=Regex.Replace(s,reg,"$1<br />");
s=Regex.Replace(s,reg2,"");
Response.Write(s);
string s="输入字符";
string reg="[\\s\\S]*?(200[\\d]{4}(\\s[\\d]{2})*)[\\s\\S]*?";
string reg2="<br />[^\\d][^\\n]*";
s=Regex.Replace(s,reg,"$1<br />");
s=Regex.Replace(s,reg2,"");
Response.Write(s);
#6
应该是这个
string reg="[\\s\\S]*?(200[\\d]{4}(\\s[\\d]{2})*)[\\s\\S]*?";
string reg2="\\n[^\\d][^\\n]*";
s=Regex.Replace(s,reg,"$1\n");
s=Regex.Replace(s,reg2,"");
s=s.Replace("\n","<br />");
Response.Write(s);
直接搞定结果
string reg="[\\s\\S]*?(200[\\d]{4}(\\s[\\d]{2})*)[\\s\\S]*?";
string reg2="\\n[^\\d][^\\n]*";
s=Regex.Replace(s,reg,"$1\n");
s=Regex.Replace(s,reg2,"");
s=s.Replace("\n","<br />");
Response.Write(s);
直接搞定结果
#1
顶
#2
试试这个:
(200[\\d]{4}(\s[\d]{2})*)
(200[\\d]{4}(\s[\d]{2})*)
#3
刚才相反的结果.我是用Replace
#4
string filecontent=..............
Regex reg=new Regex(@"([\d]{7}\s)([\d]{2}\s)+");
System.Text.RegularExpressions.MatchCollection matches=reg.Matches(filecontent);
for(int i=0;i<matches.Count;i++)
Console.WriteLine(matches[i].Value);
Regex reg=new Regex(@"([\d]{7}\s)([\d]{2}\s)+");
System.Text.RegularExpressions.MatchCollection matches=reg.Matches(filecontent);
for(int i=0;i<matches.Count;i++)
Console.WriteLine(matches[i].Value);
#5
~倒
string s="输入字符";
string reg="[\\s\\S]*?(200[\\d]{4}(\\s[\\d]{2})*)[\\s\\S]*?";
string reg2="<br />[^\\d][^\\n]*";
s=Regex.Replace(s,reg,"$1<br />");
s=Regex.Replace(s,reg2,"");
Response.Write(s);
string s="输入字符";
string reg="[\\s\\S]*?(200[\\d]{4}(\\s[\\d]{2})*)[\\s\\S]*?";
string reg2="<br />[^\\d][^\\n]*";
s=Regex.Replace(s,reg,"$1<br />");
s=Regex.Replace(s,reg2,"");
Response.Write(s);
#6
应该是这个
string reg="[\\s\\S]*?(200[\\d]{4}(\\s[\\d]{2})*)[\\s\\S]*?";
string reg2="\\n[^\\d][^\\n]*";
s=Regex.Replace(s,reg,"$1\n");
s=Regex.Replace(s,reg2,"");
s=s.Replace("\n","<br />");
Response.Write(s);
直接搞定结果
string reg="[\\s\\S]*?(200[\\d]{4}(\\s[\\d]{2})*)[\\s\\S]*?";
string reg2="\\n[^\\d][^\\n]*";
s=Regex.Replace(s,reg,"$1\n");
s=Regex.Replace(s,reg2,"");
s=s.Replace("\n","<br />");
Response.Write(s);
直接搞定结果