Regex building

rEnEeK

New member
Joined
May 27, 2009
Messages
3
Programming Experience
Beginner
Hello, I am new here and thanks for this forums :)

Now I'm making application, which will parse data from one webpage...

All works fine, but this:

Webpage code:
PHP:
 <td>Traffic left:</td><td align=right><b><script>document.write(setzeTT(""+Math.ceil(23170541/1000)));</script> MB</b></td>


VB2008 code:

VB.NET:
'Traffic Left
Dim rgxtrafficleft As New Regex("(<td>Traffic left:</td><td align=right><b><script>document.write(setzeTT(""""+Math.ceil().+()));</script> MB</b></td>)")
Dim mctrafficleft As MatchCollection = rgxtrafficleft.Matches(responsedata)
Dim strbtrafficleft As New StringBuilder

For Each mtrafficleft As Match In mctrafficleft
strbtrafficleft.Append(mtrafficleft.Value)
Next

lblTrafficLeft.Text = strbtrafficleft.ToString

So, what is bad? I tried change it, but didn't work too...

Thanks for answer :)
 
Last edited:
Thanks.. I think, it doesn't help me...

Webpage shows this:

Traffic left: 24 687 MB (+0 GB)

webpage code is:
VB.NET:
<td>Traffic left:</td><td align=right><b><script>document.write(setzeTT(""+Math.ceil(24686696/1000)));</script> MB</b></td>
                        <td><b>(<a href="javascript:alert('If required, the TrafficShare balance will automatically be credited to the download quota.')" style="cursor:help">+0 GB</a>)</b></td>

Webpage function:
VB.NET:
function setzeTT(zahl) {
    zahl = ""+zahl;
    var t = zahl;
    var tren = " ";
    if (zahl.length > 3) {
        t = setzeTT(zahl.substr(0, zahl.length - 3)) + tren + zahl.substr(zahl.length - 3);
    }
    return t;
}
 
Last edited:
Back
Top