delete please...
Printable View
delete please...
Well - what specifically are you interested in from the string? And does the response you want to parse always look that way?
Is it only the content of the Math.Ceil you want?
delete please...
So you want the evaluated value from the Math.Ceil extracted?
Meaning you get (amongst other things) the string
into your code, you want to pass it through a regex and display it?Code:<td>Traffic left:</td><td align=right><b><script>document.write(setzeTT(""+Math.ceil(24686696/1000)));</script> MB</b></td>
Then I'd think something like this would be enough:
This will for the above string, provide the result "24687 MB"Code:Dim regex As New System.Text.RegularExpressions.Regex("Math.ceil\((?<numerator>\d+)/(?<denominator>\d+)[^>]+>(?<unit>[^<]+)")
Dim match As System.Text.RegularExpressions.Match = regex.Match(str)
Dim result As String = Math.Ceiling(CInt(match.Groups("numerator").Value) / CInt(match.Groups("denominator").Value)) & match.Groups("unit").Value
(remember to check for IsMatch or whether groups exists etc before trying to convert the values to integer)
Hope this helps, otherwise I've misunderstood what you wanted :)
delete please...
Strange - which code line of the ones I showed gives you the exception?
Dim match As System.Text.RegularExpressions.Match = regex.Match(Str)
str is the string you want to parse, so it must be replaced with the content you want to match on.
I think you called it responsedata earlier.
Thanks very much, now it works... One question again...
<script>document.write(setzeTT("315926"))</script> MB</b>
How can I write this?
315926 is generated number from webpage
Where, from where (and why) do you want to write it?
I'm not sure I understand the issue.
If you need to call a javascript function with that value, numerous techniques exists from using the ScriptManager, to simply a label/span or ...... but as said - I'm not sure I understand the issue.
delete please...
Then why not just write the result string parsed from the regex into your code? Why run it through a javascript?
delete please...
Well - that code is also just wrong from what I can see. You're not putting any content into the strbstorage stringbuilder and you don't seem to use the match collection.
I think you need to take it one step at the time, because either you're trying to tackle multiple things at once and not understanding the code or similar.
You have the response string which you wanted to parse through a regular expression to show traffic remaining:
If you run that through the code I gave you, you'll have a string which contains "24687 MB" (I named it result in the example).Code:<td>Traffic left:</td><td align=right><b><script>document.write(setzeTT(""+Math.ceil(24686696/1000)));</script> MB</b></td>
Why then not just assign that result value to your label - for example like: lblStorage.Text = result
I am really starting to not understand what you're trying to accomplish because as said - it seems like multiple different things going on and it doesn't look like you're using the code snippets I provided.
I tried all, but I still don't know, how can I write it... I used google, some books, but it still doesn't work..