各位高手~
string url="http://www.baidu.com/s?bs=C%23+%/dfdfdfd";
怎么载出这个www.baidu.com  出来啊~~在线等~麻烦各位高手帮下忙!!

解决方案 »

  1.   

    string result = Regex.Match(url,@"(?<=(http://)?|^)www[^/]+").Value;
      

  2.   

    string result = Regex.Match(url,@"(?<=(http://)?|^)www[^/]+").Value;
      

  3.   


     public  string  regexdom(string url) 
        {           
           string text = url;           
           string pattern = @"(?<=http://)[\w\.]+[^/]"; 
            //C#正则表达式提取匹配URL的模式,              
            string s = "";            
            MatchCollection mc = Regex.Matches(text, pattern);
            //满足pattern的匹配集合               
            foreach (Match match in mc)            
            {                
                s = match.ToString();            
            }           
            return s;            
                     
        }   
      

  4.   

    大哥你们理解错了~~
    string url="http://www.baidu.com/s?bs=C%23+%/dfdfdfd";
    他不是固定的~~我是获取了当前网站的地址然后在变更中间的那个WWW.baidu.com   应该每个网站中间的这个地址是不同的~~
      

  5.   

    估计你大写的
    try thisstring result = Regex.Match(url,@"(?i)(?<=(http://)?|^)[^/]+").Value;