这个怎么实现?紧急紧急紧急......
有一个字符串如下:
"adfdsafsdfd adffd |aaa| adksjfkd|bbbuuu| aaaahbbbb|ccc|kajfdkaf "
我想在这个字符串里取出”||“两条线中间的字符,也就是:aaa,bbbuuu,ccc请问如何实现?
------解决方案--------------------
不好意思,差小小!
Regax regax=new Regax( "\|.{0,}?\| ")
正则最快,最简单了
------解决方案--------------------
Regax regax=new Regax( "\|.{0,}?\| ")
------解决方案--------------------
\|.{0,}?\|
\|.*?\|
------解决方案--------------------
string s = "adfdsafsdfd adffd |aaa| adksjfkd|bbbuuu| aaaahbbbb|ccc|kajfdkaf ";
Regex re = new Regex(@ "\|[^\s]+\| ");
foreach (Match m in re.Matches(s))
{
Response.Write(m.Value.Replace( "| ", " ")+ " <br/> ");
}
------解决方案--------------------
支持s1ihome(My hometown is a beautiful village) 的正解