I want to download a html source, then search for the username and other information, and then display this in my program. I'm pretty new to programming, but a straight noob when it comes to things like this (Regex) so I hope you can explain it to me.
I used Regex before extracting a K/D ratio from a html source, for that I used this code:
string pattern = @"<span class=""kdratio"">\d+\.\d+";
But I have no idea how to start on this one...
This is the line of the source that contains the information:
<section class="profile-header" profile="true" motto="user's motto" user="User" figure="hr-3322-45.hd-190-1.ch-3342-64-66.lg-285-64.sh-3068-82-66.ea-1404-64">
I only need the parts user="User" and figure="x", I couldn't try anything because I really wouldn't know how to start, because the html line looks so different from what I have experience with.
user="([^"]*?)" figure="([^"]*?)"as regex would work ( i.sstatic.net/i2Nkt.png). But it'd better to use an html parser to extract the values of the attributesuserandfigureof thissectionelement, theclass="profile-header"seems to be a good unique identifier for it. Take a look at stackoverflow.com/questions/846994/how-to-use-html-agility-pack to get to know how to use HTMLAgility Pack to parse the html, find the node (<section>) and extract attributes out of it.