-3

Quick question im trying to make a regex pattern to take out the following

<a class="btn btn-primary" data-jobid="14966420" href="/annons/job-title-here/14976320">Läs mer och ansök</a>

<a class="btn btn-primary" data-jobid="14967569" href="/annons/job-title-here/14967569">Läs mer och ansök</a>

I want the href value have tried for about 3 hours now to get the value but i cant really get my head around how regex work. Tried to learn it but never understood it. Still trying though :)

Thanks for any help in advance ;)

Daniel
  • 21
  • 8

1 Answers1

0

Just came up with an solution where i take out all the hrefs and the check if the line contains specific value. then i split the string.

Thanks 2 everyone that tried to help :)

Regex linkParser = new Regex(@"<a.*?>", RegexOptions.Compiled | RegexOptions.IgnoreCase);
        foreach (Match m in linkParser.Matches(source))
        {
            if (m.Value.Contains("data-jobid"))
            listBox1.Items.Add(m.Value);
        }
Daniel
  • 21
  • 8