是在javascript 中实现吗,如果这样的话直接用string text=document.getElementById("sn_dt_masing").innerHTML就可以取出<div >xxx </div>之间的字符串内容,然后用字符串函数处理

解决方案 »

  1.   

    如果用正则表达式一个个取的话,这个表达式应该是 reg=/\w/ig;然后通过 var array=text.match(reg);这个array数组存放着单个字符
      

  2.   

    用JS或者用Jquery
    $("div")过滤
      

  3.   


    string str="<div id=\"sn_dt_masing\">24 years old, Male </div>...";
    System.Text.RegularExpressions.Regex  reg=new  System.Text.RegularExpressions.Regex(@"<div.*?>(?<text>[^><].*?)</div>",System.Text.RegularExpressions.RegexOptions.IgnoreCase);  
    System.Text.RegularExpressions.MatchCollection m = reg.Matches(str); //设定要查找的字符串
    for (int i = 0; i < m.Count; i++)
    {
      Response.Write(m[i].Groups["text"].ToString());
    }
      

  4.   

    正则
    "(?<=>).+?(?=<)"用正则匹配的集合matchs方法全部取出.
      

  5.   

    现在没测试环境,楼主测下吧MatchCollection mc = Regex.Matches(yourStr, @"(?<=<div\b[^>]*>)[^<]*(?=</div>)", RegexOptions.IgnoreCase);
    foreach (Match m in mc)
    {
        richTextBox2.Text += m.Value + "\n";
    }
      

  6.   

    下载PilotEdit 2.5, http://topic.csdn.net/u/20090512/21/99628cbd-3c70-4d29-91ff-1962f01e7a7c.html
    新建一个文件,把数据拷贝到这个文件。<div id="sn_dt_masing">24 years old, Male </div>
    <div id="sn_dt_abttxt">喜好音乐,酷爱运动。 人生没有过去的坎! </div>
    <div class="sn_dt_itmhdr">Location </div>
    <div class="sn_dt_itmdtl" id="sn_dt_gn_loc">杭州 </div>
    <div class="sn_dt_itmhdr">Occupation </div>
    <div class="sn_dt_itmdtl" id="sn_dt_gn_oc">IT </div> 

    点排序按钮,选择“比较由正则表达式定义的字符串”,输入下面的正则表达式和目标字符串(没有空格):
    正则表达式:<div*>*</div>
    目标字符串:%04点“将目标字符串拷贝到剪贴板”,即可将你要的数据拷贝到剪贴板:24 years old, Male 
    喜好音乐,酷爱运动。 人生没有过去的坎! 
    Location 
    杭州 
    Occupation 
    IT 
      

  7.   


    string html ="<div>xxx</div>";
    html = Regex.Replace(html, "<[^>]+>", "");