greetings, fellow internet!

welcome to digitalgangster.com, the coolest community for people who hack the gibson and make bajillions of dollars off of online marketing. this version of the forum is in view only mode for archival purposes. the new forum can be found here.

ASGPHE,
ytcracker, original digital gangster
follow me on twitter
fan me on facebook
Results 1 to 11 of 11

Thread: vb.net 2008 parsing data

  1. #1
    Triage's Avatar
    Join Date
    May 2005
    Location
    The Internet
    Posts
    2,068

    Default vb.net 2008 parsing data

    anyone have an example of parsing a string such as an an img link from webpage or a certain string from the webpage...?

    not good in .net help

    aim: popper

  2. #2
    Audio's Avatar
    Join Date
    Jun 2007
    Location
    banks back room
    Posts
    15,911

    Default

    Regex
    Coder for hire. Anything you need, outstanding prices and good return time.
    Contact: Skype - GetMoneyHo, AIM - theorangebox

  3. #3

    Join Date
    Jan 2009
    Location
    7o3
    Posts
    407

    Default

    i dont know much about .net but id imagine the mid and left functions still work.
    sic semper tyrannis

  4. #4

    Default

    regex or substring

  5. #5

    Join Date
    Jan 2009
    Location
    7o3
    Posts
    407

    Default

    someone burn me vb.net2008 then mail me it ill pay for shipping and discs no lie. i cant find it working for me anywhere.
    sic semper tyrannis

  6. #6

    Join Date
    Jan 2009
    Location
    Ontario
    Posts
    1,010

    Default

    i have full academic copy of VS 2005 isos that i could put somewhere.

    also if you are wanting to parse html files i suggest using some sort of XML parser. the only problem is i highly doubt many pages of the internet are valid xml documents.
    Last edited by RPC; 03-04-2009 at 12:15 PM.
    OMG My boobs are too big for this menu
    VSE Portfolio: Click here
    (10:29:35 PM) dropc0de: but thats only because she'll treat his dick like a tub of chocolate ice cream
    * pad changes topic to 'lesbians make me sick'

  7. #7

    Join Date
    Jan 2009
    Location
    Ontario
    Posts
    1,010

    Default

    sry for dbl post.

    http://vbcity.com/page.asp?f=howto&p=strings_strtok

    tokenize a string.

    <img src="...." height="" width="" alt="">
    if you tokenize by just the " " standard space, you would get
    array[] = "<img", "src="...."", ..etc;

    ofc you could then tokenize those items more if you wanted the data in the src tag for instance. you would loop over all tokens and find the one that has a sub string of src.
    then take that token and tokenize it against "=". the 2nd token would have the src data,

    Maybe thats what your looking for?
    OMG My boobs are too big for this menu
    VSE Portfolio: Click here
    (10:29:35 PM) dropc0de: but thats only because she'll treat his dick like a tub of chocolate ice cream
    * pad changes topic to 'lesbians make me sick'

  8. #8
    I am Fredryck Fox! Vershun's Avatar
    Join Date
    May 2005
    Location
    Denver, CO
    Posts
    16,131

    Default

    Definitely use regex for this.

  9. #9

    Join Date
    Jan 2009
    Location
    Ontario
    Posts
    1,010

    Default

    Quote Originally Posted by Vershun View Post
    Definitely use regex for this.
    using System.Text.RegularExpressions;Sample code
    //Check for correct format of txtFname

    Dim myMatch As Match = System.Text.RegularExpressions.Regex.Match(WEB PAGE OR SOMETHING, "^[A-Z][a-zA-Z]*$")




    OMG My boobs are too big for this menu
    VSE Portfolio: Click here
    (10:29:35 PM) dropc0de: but thats only because she'll treat his dick like a tub of chocolate ice cream
    * pad changes topic to 'lesbians make me sick'

  10. #10

    Default

    Dim someshit As Match = Regex.Match(htmlCode, "<img src=""(.*?)"">", RegexOptions.IgnoreCase)

    someshit.groups(1).tostring() will be the url of the image.

  11. #11
    Triage's Avatar
    Join Date
    May 2005
    Location
    The Internet
    Posts
    2,068

    Default

    Ok, I will look into regex.

    Thanks to Zain and Audio for the help!

    Here is the parse code in VBNet to get between two pieces of text..

    Public Function Parses(ByVal sdata As String, ByVal delim1 As String, ByVal delim2 As String) As String
    Return sdata.Substring(sdata.IndexOf(delim1) + delim1.Length, sdata.IndexOf(delim2) - (sdata.IndexOf(delim1) + delim1.Length))
    sdata.Substring(sdata.IndexOf(delim1) + delim1.Length, (sdata.Length - sdata.IndexOf(delim2)))
    End Function

    Example

    Dim TitlePage As String

    TitlePage = Parses(htmlData, "<title>", "</title>")

    would grab between <title> and </title>

    Thanks again guys.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •