Results 1 to 3 of 3

Thread: Another Regular Expression Question?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2008
    Location
    >> ( ҉ )
    Posts
    413

    Question Another Regular Expression Question?

    http://services.runescape.com/m=item...e=all&members= Source Code From Here.

    Here Code:
    1. <tr class="row_b">
    2. <td><img src="http://services.runescape.com/m=itemdb_rs/2805_obj_sprite.gif?id=13979" alt="Corrupt dragon scimitar"></td>
    3. <td><a href="http://services.runescape.com/m=itemdb_rs/Corrupt_dragon_scimitar/viewitem.ws?obj=13979"> Corrupt dragon scimitar</a></td>
    4. <td>1.7m  </td>
    5. <td><span class="stay">0</span></td>
    6. <td>
    7. <img src="http://www.runescape.com/img/main/serverlist/star_free.png" alt="Free game item" title="Free game item">
    8. </td>
    9. <td>
    10. <img src="http://www.runescape.com/img/main/kbase/relevance/swords5.gif" alt="Maximum relevance">
    11. </td>
    12. </tr>
    13. <tr>
    14. <td><img src="http://services.runescape.com/m=itemdb_rs/2805_obj_sprite.gif?id=4587" alt="Dragon scimitar"></td>
    15. <td><a href="http://services.runescape.com/m=itemdb_rs/Dragon_scimitar/viewitem.ws?obj=4587"> Dragon scimitar</a></td>
    16. <td>100.2k </td>
    17. <td><span class="stay">0</span></td>
    18. <td>
    19. <img src="http://www.runescape.com/img/main/serverlist/star_members.png" alt="Members' item" title="Members' item">
    20. </td>
    21. <td>
    22. <img src="http://www.runescape.com/img/main/kbase/relevance/swords5.gif" alt="Maximum relevance">
    23. </td>
    24. </tr>
    25. <tr class="row_b">
    26. <td><img src="http://services.runescape.com/m=itemdb_rs/2805_obj_sprite.gif?id=7158" alt="Dragon 2h sword"></td>
    27. <td><a href="http://services.runescape.com/m=itemdb_rs/Dragon_2h_sword/viewitem.ws?obj=7158"> Dragon 2h sword</a></td>
    28. <td>1.4m  </td>
    29. <td><span class="rise">+29.8k </span></td>
    30. <td>

    If i want only Dragon Scimitar from this page what should be the code for it?

    ??? =>
    Code:
    ("(?<=Dragon scimitar</a></td>).+?(?=</td>)")
    I want it find the word Dragon Scimitar before it starts copying price of it.

    Hard to explain but there is TOO MUCH <TD> and other things and prices, only one which is different in page is NAMES of ITEMS.

    Ty for help.

  2. #2
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Another Regular Expression Question?

    Code:
            Dim input As String = _
            "<tr class=""row_b"">" & Environment.NewLine & _
    "<td><img src=""http://services.runescape.com/m=itemdb_rs/2805_obj_sprite.gif?id=13979"" alt=""Corrupt dragon scimitar""></td>" & Environment.NewLine & _
    "<td><a href=""http://services.runescape.com/m=itemdb_rs/Corrupt_dragon_scimitar/viewitem.ws?obj=13979""> Corrupt dragon scimitar</a></td>" & Environment.NewLine & _
    "<td>1.7m  </td>" & Environment.NewLine & _
    "<td><span class=""stay"">0</span></td>" & Environment.NewLine & _
    "<td>" & Environment.NewLine & _
    "<img src=""http://www.runescape.com/img/main/serverlist/star_free.png"" alt=""Free game item"" title=""Free game item"">" & Environment.NewLine & _
    "</td>" & Environment.NewLine & _
    "<td>" & Environment.NewLine & _
    "<img src=""http://www.runescape.com/img/main/kbase/relevance/swords5.gif"" alt=""Maximum relevance"">" & Environment.NewLine & _
    "</td>" & Environment.NewLine & _
    "</tr>" & Environment.NewLine & _
    "<tr>" & Environment.NewLine & _
    "<td><img src=""http://services.runescape.com/m=itemdb_rs/2805_obj_sprite.gif?id=4587"" alt=""Dragon scimitar""></td>" & Environment.NewLine & _
    "<td><a href=""http://services.runescape.com/m=itemdb_rs/Dragon_scimitar/viewitem.ws?obj=4587""> Dragon scimitar</a></td>" & Environment.NewLine & _
    "<td>100.2k </td>" & Environment.NewLine & _
    "<td><span class=""stay"">0</span></td>" & Environment.NewLine & _
    "<td>" & Environment.NewLine & _
    "<img src=""http://www.runescape.com/img/main/serverlist/star_members.png"" alt=""Members' item"" title=""Members' item"">" & Environment.NewLine & _
    "</td>" & Environment.NewLine & _
    "<td>" & Environment.NewLine & _
    "<img src=""http://www.runescape.com/img/main/kbase/relevance/swords5.gif"" alt=""Maximum relevance"">" & Environment.NewLine & _
    "</td>" & Environment.NewLine & _
    "</tr>" & Environment.NewLine & _
    "<tr class=""row_b"">" & Environment.NewLine & _
    "<td><img src=""http://services.runescape.com/m=itemdb_rs/2805_obj_sprite.gif?id=7158"" alt=""Dragon 2h sword""></td>" & Environment.NewLine & _
    "<td><a href=""http://services.runescape.com/m=itemdb_rs/Dragon_2h_sword/viewitem.ws?obj=7158""> Dragon 2h sword</a></td>" & Environment.NewLine & _
    "<td>1.4m  </td>" & Environment.NewLine & _
    "<td><span class=""rise"">+29.8k </span></td>" & Environment.NewLine & _
    "<td>"
    
            'remove new line characters
            input = input.Replace(Environment.NewLine, "")
            Dim rx As New Regex("(?<=Dragon scimitar</a></td><td>).+?(?=</td>)")
            For Each m As Match In rx.Matches(input)
                Debug.WriteLine(m.Value)
            Next
    That is the very essence of human beings and our very unique capability to perform complex reasoning and actually use our perception to further our understanding of things. We like to solve problems. -Kleinma

    Does your code in post #46 look like my code in #45? No, it doesn't. Therefore, wrong is how it looks. - jmcilhinney

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2008
    Location
    >> ( ҉ )
    Posts
    413

    Re: Another Regular Expression Question?

    Thank you. ^^ Very big code.

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