A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 郝滨 中级黑马   /  2013-2-25 20:21  /  1516 人查看  /  2 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

   string url = "http://sou.zhaopin.com/jobs/searchresult.ashx?bj=160000&jl=530&sm=0&p=1";
            WebClient wc = new WebClient();
            wc.Encoding = Encoding.UTF8;
            string html = wc.DownloadString(url);
            //<td class="Jobname"><input type="checkbox"  name="vacancyid" value="CC132250291J90251006000_530" /><a href="http://jobs.zhaopin.com/beijing/y08hadoophbase%e5%ad%98%e5%82%a8%e5%b9%b3%e5%8f%b0%e5%8c%96%e7%b3%bb_132250291251006.htm" target="_blank">Y08-hadoop/hbase存储平台化系统研发工程师(云平台)</a></td>

//<td class="Jobname"><input type="checkbox"  name="vacancyid" value="CC487620826J90250013000_530" /><a  target="_blank">文档工程师  网站编辑</a></td>
            string str = "<td class="Jobname">\.+\>(\.)</a></td>";//额 ,明显的不行呀
            MatchCollection matches = Regex.Matches(html, str);
            foreach (Match  mat in matches)
            {
                if (mat.Success)
                {
                    
                }
            }
            Console.ReadKey();
就是红色字体显示的那样,要如何用正则表达式选出其中“文档工程师  网站编辑” 这样的职位信息?

评分

参与人数 1技术分 +1 收起 理由
张文 + 1

查看全部评分

2 个回复

倒序浏览
string url = "http://sou.zhaopin.com/jobs/searchresult.ashx?bj=160000&jl=530&sm=0&p=1";
            WebClient wc = new WebClient();
            wc.Encoding = Encoding.UTF8;
            string html = wc.DownloadString(url);

            MatchCollection matches = Regex.Matches(html, "target=\"_blank\">(?<value>.+?)</a></td>");
            foreach (Match mat in matches)
            {
                if (mat.Success)
                {
                    string value = mat.Groups["value"].Value.ToString();
                    MessageBox.Show(value);
                }
            }

评分

参与人数 1技术分 +1 收起 理由
张文 + 1

查看全部评分

回复 使用道具 举报
王立 发表于 2013-2-25 20:37
string url = "http://sou.zhaopin.com/jobs/searchresult.ashx?bj=160000&jl=530&sm=0&p=1";
            ...

嗯 可以了 就是前几条后面出现三行代码  剩下的都正常输出  还把公司名称输出了
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马