c# 截取字符串的问题 如果在一串字符中id 在100行

c# 截取字符串的问题 如果在一串字符中id 在100行 我要获取id后面的10个数字 请问怎么截取呢

 string[] lines = s.Split(new string[] {"\r\n"}, StringSplitOptions.None);
string s = lines[99];
string result = Regex.Match(s, "(?<=id)\\d{10}").Value;

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.test.org/DTD/xhtml-mobile10.dtd">




test

kground-color:#daeaf4;color:#666;text-align:center;padding-top:5px;padding-bottom:5px} .t10{padding-left:10px;padding-bottom:5px} /* foot */ .t01{line-height:20px;padding:5px 5px 3px 5px;} /* 我的首页css */ .thot{line-height:1.7;color:#646464;border:1px solid #d1e3f0} /* 热门关键字 */ .thot a{margin-right:7px;white-space:nowrap} .t2 textarea{margin-top:5px;margin-bottom:3px} .t4 a img{margin:3px 0} .nob{border:none} .tp a{padding:0 5px} .meta{color:#888;font-weight:normal;padding:0 5px} .txt{margin-bottom:5px} .btn{border:1px solid #666} .btn{border-top:1px solid #fff;border-left:1px solid #fff;border-right:1px solid #808080;border-bottom:1px solid #808080} .pl5,.cl5{line-height:1.4; padding-left:5px} .mContent .pl5{padding-left:0} .mTitle{border:1px solid #d1e3f0;background-color:#e0eef8;color:#888;} .item{line-height:1.4;border-bottom:1px dashed #A8A8A8;padding:10px; } .userlist{border-bottom:1px dotted #888888;margin-top:1px;padding-bottom:1px;} #logo{background:#91bbd7;padding:5px 0 5px 0;height:24px} .t8 .meta{padding:0;font-weight:normal} .t3 span{color:#888} .t11{padding:5px; margin:3px 2px 0 2px;} .t11 td{text-align:left;} #table {clear:both;} #table ul {width:500px;list-style:none} #table li {border:1px solid #ccc;float:left;height:22px;text-align:center;line-height:22px}



首页

登录成功! 1

1。

如果10秒后未跳转,请直接访问

回顶部 top↑ 普版

首页-导航-反馈


哪里id后面有10位数字??

 <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml;charset=UTF-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>test</title>
<meta http-equiv="Cache-Control" content="max-age=" forua="true"/>
<meta name="viewport" content="width=device-width" />

<style>  html,body,p,form,table,input,span,div{font-size:14px;word-wrap:break-word;font-family:Arial,sans-serif} textarea{width:93%;font-size:14px}  body{background:#f7fcff;color:#000;padding:0;margin:0;font-family:Arial,sans-serif;} p,form,a,h3{margin:0} img{border:none} a{color:#15478d;text-decoration:none} h3{font-size:14px;font-weight:bold} input.text{width:150px} img.photo-48{width:48px;height:48px} img.photo-130{width:130px} img.photo-full{margin:1px 0} .red{color:#f00} .time{color:#888} .error{background-color:#ffece6;border:1px solid #ffe1d8}  /* 发布失败 */ .tip{background-color:#f1ffc3;border:1px solid #e1f2a7;padding-left:5px;margin:3px 0} /* 发布成功 */ .ok{padding:3px 5px;margin:5px 0;background-color:#fff} .t1,.t2,.t3,.tcontent,.t7,.thot,.error,.tip,.ok,.mTitle{padding:5px;margin:3px 2px 0 0} tcontent{padding:5px;margin:3px 2px 0 2px} .t0{background:#91bbd7;padding:3px 2px 3px 0;height:35px;} /* logo */ .t1{border:1px solid #aacce3;background-color:#ddedf8;} /* title & topNav*/ .t1 b{font-weight:normal;} .t2{border:1px solid #d1e3f0;background-color:#e0eef8;color:#888} /* inputarea*/ .t3{border:1px solid #d1e3f0}    .tcontent{border:0px} /*  提示信息(只有边框的) */ .t4{border-bottom:1px dashed #a8a8a8;padding:10px;line-height:1.4}    /* 单条 */ .t6{color:#888} /* 统计信息 */ .t6 span{padding-right:10px}   .t7{border:1px solid #f1d58a;background-color:#f5f1c3}  /* 有色提示信息 tip*/ .t8{line-height:1.4} /* 行高1.4,没有边距(只用来扩大行高用)*/ .tp{border-bottom:1px dashed #a8a8a8;padding:10px;color:#888}   /* 翻页 */ .t9{background-color:#daeaf4;color:#666;text-align:center;padding-top:5px;padding-bottom:5px} .t10{padding-left:10px;padding-bottom:5px}  /* foot */ .t01{line-height:20px;padding:5px 5px 3px 5px;} /* 我的首页css */ .thot{line-height:1.7;color:#646464;border:1px solid #d1e3f0}  /* 热门关键字 */ .thot a{margin-right:7px;white-space:nowrap} .t2 textarea{margin-top:5px;margin-bottom:3px} .t4 a img{margin:3px 0} .nob{border:none} .tp a{padding:0 5px} .meta{color:#888;font-weight:normal;padding:0 5px} .txt{margin-bottom:5px} .btn{border:1px solid #666} .btn{border-top:1px solid #fff;border-left:1px solid #fff;border-right:1px solid #808080;border-bottom:1px solid #808080} .pl5,.cl5{line-height:1.4; padding-left:5px} .mContent .pl5{padding-left:0} .mTitle{border:1px solid #d1e3f0;background-color:#e0eef8;color:#888;} .item{line-height:1.4;border-bottom:1px dashed #A8A8A8;padding:10px; } .userlist{border-bottom:1px dotted #888888;margin-top:1px;padding-bottom:1px;} #logo{background:#91bbd7;padding:5px 0 5px 0;height:24px} .t8 .meta{padding:0;font-weight:normal} .t3 span{color:#888} .t11{padding:5px; margin:3px 2px 0 2px;} .t11 td{text-align:left;} #table {clear:both;} 
#table ul {width:500px;list-style:none} 
#table li {border:1px solid #ccc;float:left;height:22px;text-align:center;line-height:22px}
</style>

</head>
<body>
<a name="top"></a>
<div class="t0"><a href="http://wap.test.cn"><img src="http://wap.test.cn/img/logo.png" alt="11" /></a></div>
<div class="tcontent">
<meta http-equiv="refresh" content="10 url=/test.php?id=1122334455676770" /><p class="t1">登录成功! <a href='/test.php?id=112233445567677'>。</div><p class="t7">如果10秒后未跳转,请<a href='/test.php?id=112233445567677'></a></p>
<div class="t3">
<a href="/my_friend_m.php?uid=a63348816c50b10b7b267c4e6788f470">返回</a><br/>
</div>
<p class="t3">

    <a href="#top">回顶部&nbsp;top↑</a>  <a href="http://wap1.feelyou.cn">普版</a>
</p>


<p class="t4 nob">
<a href="/search_user.php?id=112233445567677" >首页</a>-<a href="/test.php?id=112233445567677">导航</a>-<a href="/test.php?id=112233445567677" >反馈</a> <img border="0" height="1px" width="1px" src="http://img.users.51.la/5376029.asp" />
</p>
</div>
<p id="footer" class="t9">  
</p>

</body>
</html>
 string result = Regex.Match(textBox1.Text, "(?<=id)\\d{10}").Value;

这个应该是可以的。

 string result = Regex.Match(textBox1.Text, "(?<=id\=)\\d{10}").Value;

你id后面还有一个等于号,用这个

 string result = Regex.Match(textBox1.Text, "(?<=id\\=)\\d{10}").Value;