<IIsWebServer Location ="/LM/W3SVC/1080967266"
LogFileDirectory="E:\Vhost\WebRoot\pinfdc\LogFiles"
LogType="1"
MaxBandwidth="1048576"
MaxConnections="100"
ServerAutoStart="TRUE"
ServerBindings=":80:www.pinfdc.com
:80:pinfdc.com
:80:www.fdchn.cn
:80:pinfdc.vhost1.hytele.com"
ServerComment="pinfdc"
ServerSize="1"
>
</IIsWebServer>
把其中ServerBindings=":80:和:80:pinfdc.vhost1.hytele.com"之间的URL提出来,www.pinfdc.com pinfdc.com www.fdchn.cn

解决方案 »

  1.   

    本帖最后由 lxcnn 于 2010-12-28 12:56:06 编辑
      

  2.   

    string pstr = @"(?s)((?::80:[^:]*)+):80:pinfdc\.vhost1\.hytele\.com";Match m = Regex.Match("..", pstr);string[] strs = Regex.Split(m.Group[1].value, ":80:");//第一项是空的,取值要Trim()一下
      

  3.   

    谢了,我找到了一种方法,和你第二种稍有差别
     foreach (vhttp vh in ahttp)
                            {
                                MatchCollection mc = Regex.Matches(IISstr, @"ServerBindings=\""([^""]*):80:" + vh.hshttp.Trim(), RegexOptions.IgnoreCase);                         if (mc.Count>0)
                             {
                                 foreach (Match m in mc)
                                 {
                                     Regex reg = new Regex(@":80:");
                                     string[] wad = reg.Split(m.Groups[1].Value);
                                     string strc = vh.name;                                 foreach (string st in wad)
                                     {
                                         strc += " " + st.Trim();
                                     }                             }   
                             }
                             else
                             {
                                richTextBox1.Text += vh.name+"\n";
                             }
                            }
    你的也应该是对的,没试了