我有个字符串string s="<html>1234</html>";我想取 中间的1234 怎么办

解决方案 »

  1.   

     string s = "<html>1234</html>";
                string html = System.Text.RegularExpressions.Regex.Replace(s, "<[^>]+>", "");
                MessageBox.Show(html);
      

  2.   

    直接INDEXOF,然后数一下从第几位到第几位
      

  3.   


     string abc = "<html>1234</html>";
                abc=abc.Substring(6,abc.IndexOf("</html>")-1);
      

  4.   

    string s = "<html>1234</html>";
                Regex reg = new Regex(@".*\>(?<mm>.*)\<.*");
                MessageBox.Show(reg.Match(s).Groups["mm"].Value);
      

  5.   


    (?<=\<html\>).*(?=\</html\>)正则
      

  6.   

    [code=C#](?is)(?<=<html>).*?(?=</html)[code]
      

  7.   

    诶其,如果简单的话就else
      

  8.   


    Regex r = new Regex(@"\d+",RegexOptions.Compiled);
           string str = r.Match(s).ToString();
           MessageBox.Show(str);
      

  9.   

    只能针对<html>1234</html>";红色区域一定要数字,不能有//,/这些啊
      

  10.   

    you can write 3 functions, the first one get the right side of a seperator,
    the second one get the left side of a seperator,
    the third one get the one between two seperators using the functions above.
    all use substring.ps: why my google-pingyin is always broken??