string str = "测试二||312000100036515&&&服务器测试1||180183852208510&&&";
int index1 = str.IndexOf("||")+2;
int index2 = str.IndexOf("&&&");
string value = string.Empty;
if (index1 >= 0 && index2 > index1)
value = str.Substring(index1, index2 - index1);
调试欢乐多
@"^[^\|]*\|\|(?<m>[^\|\&]*)"Groups["m"];
String tpm = sru.Substring(sru.IndexOf("||")+2);
String tpm2 = tpm.Substring(0,tpm.IndexOf("&&&"));
textBox2.Text = tpm2;
@"(?<=^[^|]+\|\|)[^&]+" //这样就可以了
Regex objRegex = new Regex(@"(?<=\w+||)\d+(?=&&&)");
MatchCollection objMatches = objRegex.Matches(str);
foreach (Match objMatch in objMatches)
{
Response.Write(objMatch.Value + "<br/>");
}
//312000100036515
//180183852208510