如何使用前两个字母大写的正则表达式字符组搜索模式?

时间:2016-01-30 19:36:27

标签: regex webclient system.net

我正在尝试使用system.net和正则表达式废弃一个看起来像图片中的网页,以获取类似于创建者的信息:see the picture!

到目前为止,这是我的代码:

String html = web.DownloadString("https://..");
            MatchCollection m1 = Regex.Matches(html, @"<div>\s*(.+?)\s*</div>", RegexOptions.Singleline);

            foreach (Match m in m1)
            {
                string tarif = m.Groups[1].Value;
                tarife.Add(tarif);

当我尝试检查Chrome中的元素时,它看起来像这样:

inspect element from Chrome

我如何使用正则表达式提取名称,任何可以建议我的人?

1 个答案:

答案 0 :(得分:0)

你的意思是那样吗?

var str = "dsGHsal TDascultu sdOfsaf JParker OFHlsdjfls"
var re = /\b[A-Z]{2}[a-z]+/g
matches = str.match(re)       //["TDascultu", "JParker"]