Results 1 to 9 of 9

Thread: How to get title class through regex

  1. #1

    Thread Starter
    Addicted Member JackIlPazzo's Avatar
    Join Date
    Oct 2014
    Posts
    183

    How to get title class through regex

    Hi all,

    I'm trying to get a particular content in a web page the "title", in this website: http://tinyurl.com/ojoakxl



    there's the table "Classifica" with some teams, I would grab "Ultime 5 partite" form, if the user overlapping the mouse on the colorful box appear a team result for the specific day. I would grab this title class; so I realized a regex like this:

    Code:
    .giornata_1_casa = Val(Regex.Match(Content, "<td class=""(form-icon form-draw | form-icon form-win | form-icon form-loss )""\s*></td>").Groups(1).ToString)
    I used the "|" operator because there's three type of class (draw, win, loss) with yellow, green, red color.
    Is possible catch the title for this specific class in one regex? Because my pattern doesn't working.

  2. #2
    Fanatic Member Toph's Avatar
    Join Date
    Oct 2014
    Posts
    655

    Re: How to get title class through regex

    Here.

  3. #3

    Thread Starter
    Addicted Member JackIlPazzo's Avatar
    Join Date
    Oct 2014
    Posts
    183

    Re: How to get title class through regex

    Quote Originally Posted by Toph View Post
    Here.
    I'm not very good with the regex, is good for vb.net?:

    Code:
    .giornata_1_casa = Val(Regex.Match(Content, "<td class=""(.*)[D|W|L]""\s*></td>").Groups(1).ToString)
    Thank you so much!

  4. #4
    Fanatic Member Toph's Avatar
    Join Date
    Oct 2014
    Posts
    655

    Re: How to get title class through regex

    Hold on. What are you trying to grab? Show me. Be as descriptive as possible.

  5. #5

    Thread Starter
    Addicted Member JackIlPazzo's Avatar
    Join Date
    Oct 2014
    Posts
    183

    Re: How to get title class through regex

    Quote Originally Posted by Toph View Post
    Hold on. What are you trying to grab? Show me. Be as descriptive as possible.
    The regex return me "0", I'm trying to get the title of the html element. For example the element title in the image is: Juventus - Chievo Verona 2 - 0. I want that the regex grab this content for each colorful box

    Code:
     .giornata_1_casa = Val(Regex.Match(Content, "<a href=""(.*)"" class=""(.*)"" title=""(.*)"">[D|W|L]</a>").Groups(1).ToString)

  6. #6
    Fanatic Member Toph's Avatar
    Join Date
    Oct 2014
    Posts
    655

    Re: How to get title class through regex




    Code:
    Imports System.Text.RegularExpressions
    Imports System.Net
    
    Module Module1
    
        Sub Main()
            Dim response As String
    
            Using wc As New WebClient()
                response = wc.DownloadString("http://it.soccerway.com/national/italy/serie-a/20142015/regular-season/r27139/?ICID=SN_01_01")
            End Using
    
            For Each m As Match In Regex.Matches(response, "<a href=""(.*)"" class=""(.*)"" title=""(.*)"">[D|W|L]</a>")
                Console.WriteLine(m.Groups(3).ToString())
            Next
    
            Console.ReadLine()
    
        End Sub
    
    End Module

  7. #7

    Thread Starter
    Addicted Member JackIlPazzo's Avatar
    Join Date
    Oct 2014
    Posts
    183

    Re: How to get title class through regex

    Uhm you working on a different link, I don't know if a different link can cause the regex failed.
    I using an algorithm that assembles the link according to the parameters that the user has entered ..
    For example the link of the image is:

    link

    You think that is a link problem?

  8. #8
    Fanatic Member Toph's Avatar
    Join Date
    Oct 2014
    Posts
    655

    Re: How to get title class through regex

    If that data is in JSON format, then parse the JSON then. You're really confusing me.

  9. #9

    Thread Starter
    Addicted Member JackIlPazzo's Avatar
    Join Date
    Oct 2014
    Posts
    183

    Re: How to get title class through regex

    Sorry for the confusion. I already parse the page, I obtain all content of the link. Now I've a function that use regex for get a specific content through the parsed page.
    If you see the link that I've posted previously you can see that the structure of the content is like this:

    Code:
    <a href=\"\/matches\/2015\/01\/25\/italy\/serie-a\/juventus-fc\/ac-chievo-verona\/1836483\/\" class=\"form-icon form-win \" title=\"Juventus - Chievo Verona 2 - 0\">W<\/a>
    You think that your regex working on this structure? Because in my code return 0

Posting Permissions

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



Click Here to Expand Forum to Full Width